ez.no / exponential / documentation / reference / template functions / variables / sequence
{sequence name=value1 loop=value2}
...tpl code
{sequence name=value1}
...tpl code
| Name | Type | Description | Required |
|---|---|---|---|
| name | string | Name of sequence | yes |
| loop | array | Variable to iterate | yes |
The sequence function allows for creating a sequence which is iterated over and wrapped around when the end is reached. This is particularly useful when you want to alternate colors in a list. It's possible to create multiple sequences and advance them individually.
name
You have to name the sequence something.
loop
An array holding the elements to iterate.
example
In this example the sequence a, b, c is repeated)
{sequence name=Seq loop=array(a,b,c)} <table> <tr><th>Sequence value</th><th>Section item</th></tr> {section name=Loop1 loop=array(1,2,3,4,5,6)} <tr><td>{$Seq:item}</td><td>{$Loop1:item}</td></tr> {* Next sequence *} {sequence name=Seq} {/section} </table>
The output of this example is
Sequence value Section item a 1 b 2 c 3 a 4 b 5 c 6
Log in or create a user account to comment.
Comments