for

Summary

Creates a generic for loop.

Usage

{for <number> to <number> as $itemVar [ sequence <array> as $seqVar ]}
    [ {delimiter}...{/delimiter}]
    [ {break}    ]
    [ {continue} ]
    [ {skip}     ]
{/for}

Description

This mechanism makes it possible to do generic looping. It supports looping over numerical ranges in both directions. In addition it also supports breaking, continual and skipping.

Examples

Example 1

{for 0 to 7 as $counter}
 
    Value of counter: {$counter} <br />
 
{/for}

The following output will be produced:

Value of counter: 0
Value of counter: 1
Value of counter: 2
Value of counter: 3
Value of counter: 4
Value of counter: 5
Value of counter: 6
Value of counter: 7

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.