Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

do

Summary

Creates a do...while loop.

Usage

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

Description

This mechanism is very similar to the "while" construct, except that the expression is checked at the end of each iteration instead of in the beginning. The main difference is that this construct will always execute the first iteration (regardless of how the test expression evaluates). It supports breaking, continual and skipping.

Examples

Example 1

{do}
 
    Keep printing this line ({$counter}) <br />
    {set $counter=inc( $counter )}
 
{/do while ne( $counter, 8 )}

If the initial value of $counter is 0, the following output will be produced:

Keep printing this line (0)
Keep printing this line (1)
Keep printing this line (2)
Keep printing this line (3)
Keep printing this line (4)
Keep printing this line (5)
Keep printing this line (6)
Keep printing this line (7)
Keep printing this line (8)

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

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


Comments

There are no comments.