this is a drag :(

All things related to where and how we will code, where to find the code etc.

Moderator: Dracones

this is a drag :(

Postby EdB » Tue Jul 13, 2010 8:11 pm

Item->title(), like most ... hey these are methods right? Functions that are specific to a class is a method of that class? Anyway like most of those things, Item->title has params for before and after. In this case the default values are empty and empty, and in most cases they are simply not used.

Given the pile of templates I have, I find 98 files with Item->title( in them.
A very common thing (60 files) puts what could be before and after param values are used before and after, like this:
Code: Select all
<h2 class="post_title"><?php $Item->title(); ?></h2>

All the rest have something that means we wouldn't be able to put the H tag into the param values, like this:
Code: Select all
    <h1>
    <a href="<?php $Item->permanent_url(); ?>" title="<?php echo T_('Permanent link to full entry'?>"></a>
    <?php $Item->title(); ?>
    </h1>


So here's the problem: the first code block looks okay and certainly works, but this whole effort has been all about consistency across templates and functions/methods. Even tiny little details like "comments in code in templates don't use capitals or have a period at the end". Simple right? So by the way I've been doing all this, the before and after HTML bits would be param values. But ... it just seems like ... I dunno. Thoughts?
EdB
Dracone
User avatar
 
Posts: 1467
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: this is a drag :(

Postby Tblue » Sun Jul 18, 2010 6:29 pm

Well, ideally one should use the template tag params where possible, but then, it would again be a lot of work for something that's not that bad anyway...
Tblue
Dracone
User avatar
 
Posts: 289
Joined: Sat Nov 21, 2009 1:35 pm
Location: Berlin, Germany

Re: this is a drag :(

Postby EdB » Sun Jul 18, 2010 7:00 pm

Already done :)

I went with "do it the way everything else is unless there's a damned good reason why not". Breaking the page seemed like a good reason why not. Apparently it didn't like having <title> as a param for some reason. Dunno or care why - it choked so I undid all that.

I think it looks a little prettier too. A few less instances of getting out of php long enough to do a tiny bit of html then right back in to php ... not that I know if that is a good or bad or neutral thing.
EdB
Dracone
User avatar
 
Posts: 1467
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona


Return to Coding and stuff

Who is online

Users browsing this forum: No registered users and 1 guest