Template control structures
Conditional control
Function | Summary |
---|---|
if | Allows conditional control by the way of an IF-THEN-ELSE mechanism. |
switch | Allows conditional control of code execution. |
Looping
Function | Summary |
---|---|
do | Creates a do...while loop. |
for | Creates a generic for loop. |
foreach | Iterates over arrays in different ways. |
while | Creates a while loop. |
Deprecated
Function | Summary |
---|---|
section | Deprecated looping, branching, etc. |
Balazs Halasy (22/02/2005 12:59 pm)
Balazs Halasy (07/07/2005 11:44 am)
Comments
Section?
Wednesday 06 July 2005 9:46:17 pm
Joe
http://ez.no/ez_publish/documenta...plate_functions/program_flow/section
This is one of the most-used template control structures. Why isn't it here?
Re: Section?
Thursday 07 July 2005 11:41:49 am
Balazs Halasy
The {section...}-style syntax has been deprecated. It belongs to the old template syntax, which will not be documented here. The new control structures (outlined above) replace the old ones. If you're looking for the documentation of {section...}; please refer to the old documentation.
Allman
Re: Section?
Thursday 07 July 2005 10:38:56 am
Massimiliano Bariola
because in 3.6 they decided to do away with old template syntax in favor of a newer one which is more unified with common programming languages.
3.6 is back-compatible though, so you'll be able to use the syntax you're used to, and run your old code under it (shipped templates with 3.6 ARE using the old syntax, yet). but for new development tasks, I think you'll be better offusing the newer syntax.
substitute for {section loop=..
Wednesday 13 July 2005 12:20:27 pm
patrick kaiser
you are saying here that the {section -construct should be avoided in the future. since i'm relativly new to ez-publish i'd like to get used to the the 'right' ways of template programming right from the beginning. but i cannot find a way to loop over results from a fetch differently than the old {section loop=... way.
i tried it with {while and {for statments with no success..
what is best practice for looping over results using the new control structures?
Re: substitute for {section loop=..
Wednesday 13 July 2005 3:03:21 pm
Alimi Nabil
You should try the {foreach} statement.
It works nearly the same way as the section loop.
If you want to add conditions, then add a {if} statement.
An example of using a foreach loop instead of the deprecated section?
Sunday 11 December 2005 7:44:25 am
Charles
Thanks.
Refer to "logical operators"
Friday 16 June 2006 11:53:04 am
Leif Arne Storset
http://ez.no/doc/ez_publish/techn...emplate_operators/logical_operations