sequence

Summary

Creates a sequence that can be iterated over.

Usage

{sequence name=value1 loop=value2}
...tpl code
{sequence name=value1}
...tpl code

Parameters

NameTypeDescriptionRequired
name string Name of sequence yes
loop array Variable to iterate yes

Returns

Description

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.

Examples

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

Comments

Log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
    GUI
    Miscellaneous
    Program flow
    Variables
       append-block
       default
       let
       sequence
       set
       set-block
Data fetching
Modules
XML tags


Created

06/02/2004
2:23:42 pm
by Balazs Halasy

Last updated

18/02/2004
3:20:23 pm
by Vidar Langseid

Authors

Balazs Halasy
Vidar Langseid



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.