User Tools

Site Tools


en:public:developer:template_system:tags:expression:for

Table of Contents

<#for>

The For tag starts a control loop, which is executed a finite number of times.

The Variable is set to the result of the 1st Expression. If the result is less than or equal to the result of the 2nd Expression (when to is specified), then the Statement is executed. Variable is then incremented by 1 and the process is repeated until the variable value exceeds the 2nd expression value.

For downto, the variable value is checked as being greater than or equal to the 2nd expression, and its value is decremented at the loop end.

Parameters

Name Mandatory Description
var Yes Variable name
from Yes 1rt value of variable “name”
to Yes 1) Prefixes an incremental for loop target value
downto Yes 2) Prefixes an decremental for loop target value
do Yes action to do

Literal

<#for var=”…” from=”…” to=”…”>actions<#endfor>

Example

  <#for var="i" from="0" to="5">
    <#i><br />
  <#endfor>  

The above example will output:

  0
  1
  2
  3
  4
  5
1) , 2) parameter to or downto are mandatory
en/public/developer/template_system/tags/expression/for.txt · Last modified: 2012/11/25 18:50 by admin