if admin chooses no logo in theme config, bluemarine still lays down an img tag which points back to the site home page. thats a sure way to increase your load and bandwidth. yikes!

Comments

moshe weitzman’s picture

pushbutton already avoids this mistake so i copied its code.

Uwe Hermann’s picture

StatusFileSize
new791 bytes

The patch is broken. Here's a fixed one.

anders.fajerson’s picture

When your at it: shouldn't

..

,

..

etc. be wrapped with
to remove the empty

when not in use. Cleaner XHTML output. Or is it too expesive to check that for each div?
anders.fajerson’s picture

My mistake :) I meant:

Shouldn't <div class='site-slogan'>... </div> , <div id="secondary">... </div> etc. be wrapped with <? php if ... ?> to remove the empty when not in use. Cleaner XHTML output. Or is it too expesive to check that for each div?

anders.fajerson’s picture

... wrapped with <?php if ... ?> ...

sorry... BTW, the preview function doesn't work :)

Uwe Hermann’s picture

StatusFileSize
new1.43 KB

Sure, why not. I don't think performance will suffer too much. Here's an updated patch.

chx’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.48 KB

The patch was OK but was not from Drupal directory. I rerolled and I think it's a go.

dries’s picture

Status: Reviewed & tested by the community » Needs work

Can we write "normal" if-statements with curly brackets? It's more consistent with the rest of the template(s). It's not clean to mix both styles.

Bèr Kessels’s picture

I have only ever seen the if ($foo): veriosn in phptemplate themes, Dries. CHXs version only follows this de-facto coding-standard.

adrian’s picture

When i wrote the first template, i took the time to read up on other systems using php for templating, and from what i've read .. and from my experience ... the : method is simpler for newbies to understand.

There's no specific reason we can't use {} , other than counting brackets inside tag soup can get hairy =)

robertdouglass’s picture

+1 for the : syntax. I'd like to see it used everywhere.

Uwe Hermann’s picture

Status: Needs work » Reviewed & tested by the community

OK, lets see if Dries agrees.

dries’s picture

I think using { } is better but I don't feel strong about it. My point is that we're mixing both styles:

    <?php if ($sidebar_right) { ?><td id="sidebar-right">
      <?php print $sidebar_right ?>
    </td><?php } ?>

(Random example taken from the same template file, themes/bluemarine/page.tpl.php.)

Uwe Hermann’s picture

StatusFileSize
new1.68 KB

OK, new patch only using { }.

anders.fajerson’s picture

As a non php coder I agree with adrian that <?php if ($foo): ?> is esier to read/understand. The closing <?php endif; ?> makes more sense than <?php } ?> Another argument could be that that wordpress themes use it...

But of course whats really matters is consistency.

kbahey’s picture

I find that when writing code in php-only modules, the curly brace is more natural, and clear.

if ($something {
}

But when writing PHP intermixed with HTML (e.g. phptemplate theme, and others themes), the alternate syntax is much more readable

if ($something) :
HTML Code goes here
endif;

I would rather that themes use the alternate syntax just because it is easier to see than a single }.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)