[clug-progsig] Odd PHP structure
Shawn
sgrover at open2space.com
Wed Mar 29 21:23:44 PST 2006
I'm working on a custom template for my website, and the sample code has the
following snippet:
<?php if ($sidebar_left != ""): ?>
<div id="sidebar-left">
<?php print $sidebar_left ?>
</div>
<?php endif; ?>
The logic is crystal clear to me, but the syntax looks odd. The manual says
the right way to do a multiline if statement in PHP is like so:
<?php
if (condition) {
statement;
statement;
}
?>
Now, I can see that the difference is in how the if statement splits up PHP
script blocks, but I would think the syntax would use braces like this:
<?php if ($sidebar_left != "") { ?>
<div id="sidebar-left">
<?php print $sidebar_left ?>
</div>
<?php } ?>
And apparently this works.
Am I seeing an old style of PHP? Am I missing something in the documentation?
Thanks for any tips.
Shawn
More information about the clug-progsig
mailing list