{while <condition> [ sequence <array> as $seqVar ]} [ {delimiter}...{/delimiter} ] [ {break} ] [ {continue} ] [ {skip} ] {/while}
This construct is the simplest loop mechanism that the template language offers. It tells eZ publish to execute the nested statement(s) repeatedly, as long as a given expression evaluates to TRUE. The value of the expression is checked for every loop iteration (at the beginning of the iteration). If the given expression evaluates to FALSE from the very beginning, the nested statement(s) will not be executed.
{while ne( $counter, 8 )} Print this line eight times ({$counter}) <br /> {set $counter=inc( $counter )} {/while}
If the initial value of $counter is zero, the following output will be produced:
Print this line eight times (0)
Print this line eight times (1)
Print this line eight times (2)
Print this line eight times (3)
Print this line eight times (4)
Print this line eight times (5)
Print this line eight times (6)
Print this line eight times (7)