ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

while

Summary

Creates a while loop.

Usage

{while <condition> [ sequence <array> as $seqVar ]}
    [ {delimiter}...{/delimiter} ]
    [ {break}    ]
    [ {continue} ]
    [ {skip}     ]
{/while}

Description

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.

Examples

Example 1

{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)

Balazs Halasy (22/02/2005 1:11 pm)

Balazs Halasy (28/04/2005 8:31 am)


Comments

There are no comments.