Re: [PHP Template] dynamic blocks

From: Date: Thu, 17 Feb 2000 15:03:38 +0000
Subject: Re: [PHP Template] dynamic blocks
References: 1 2 3 4 5 6 7 8  Groups: php.template 
Request: Send a blank email to php-template+get-107@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > > On Wed, 16 Feb 2000, Monte Ohrt wrote: > > It would probably work without the braces, but then you have two > > separate formats of your variables in the template. We have a better > > consistancy in that regard with this format: > > > > {if: $title != "foo"} > > <b>$title</b> > > {else:} > > <b>none</b> > > {/if} > > Actually, I'm starting to think that having $ in front of variables is > better. {{$varname}} would print the variable, and then you can refer to > them in if statements in the same manner. > > What does everyone think about consistency of using : to delimit > commands? In the above example there is : after 'else' but not after > '/if', is that OK? Should 'else' not have :? > > What about named attributes for commands, i.e. > {{section: name = header}} instead of {{section: header}}? > > -Andrei I like the idea of attributes, it keeps the template syntax flexible. It looks like we're kind of using colon as a way to recognize logic elements of the template, much the same way Zope prepends "dtml-" to everything (which is kind of ugly in my opinion.) Here are some ideas. Whatever we go with, it should be consistant: {if: $title != "foo"} <b>$title</b> {else:} <b>none</b> {/if:} {%if $title != "foo"} <b>$title</b> {%else} <b>none</b> {%/if} {:if $title != "foo"} <b>$title</b> {:else} <b>none</b> {:/if} {if $title != "foo"} <b>$title</b> {else} <b>none</b> {/if} After first glance at these, I kind of like the one with a colon at the end. I'm not sure if the /if and else tags need colons, but maybe they should for consistancy. Monte

« previous php.template (#107) next »