[thelist] Alternative Control Structure Syntax in PHP

Randal Rust randalrust at gmail.com
Tue Aug 29 12:36:47 CDT 2006


On 8/29/06, Hershel Robinson <hershel at galleryrobinson.com> wrote:

> You may be familiar with the alternative 'colon' syntax of PHP control
> structures:

Yes, I use it all of the time. I like it because I can use it to
cleanly separate blocks of HTML that are supposed to be displayed
based on a value. For example, I have a class called Display that
controls what the user sees. So I have this on every page:

<?php if($display->view): ?>
<?php endif; ?>

If view is false, you hide everthing within the block. It makes it
really easy to show/hide error/confirmation messages too.

> But it seems there are reasons against it as well.

If the argument against is that the tools don't support it, then the
problem isn't the syntax.

-- 
Randal Rust
R.Squared Communications
www.r2communications.com



More information about the thelist mailing list