Blocks:for

From Dwoo Docs

(Redirected from For)
Jump to: navigation, search

Similar to the php for statement

for(string $name, mixed $from, [ int $to = null, [ int $step = 1, [ int $skip = 0 ]]]) 
  • name : foreach name to access it's iterator variables
  • from : array to iterate from (which will translate to 0) or a number as a start value
  • to : value to stop iterating at (if you set an array in $from, this is automatically set to count($array))
  • step : defines the incrementation of the pointer at each iteration

Note that this plugin supports iterator variables through the name parameter and also supports the else plugin




Example:

{for i 0 5} {$i} {/for}
 
{for i 0 5 2} {$i} {/for}
 
{$arr=array("Bob","John","Jim")}
{for i $arr}
{$i} -> {$arr.$i} {* or $arr[$i] *}
{/for}

Output:

0  1  2  3  4  5 
0  2  4 
0 -> Bob
1 -> John
2 -> Jim
Personal tools
templates
page language

French

The article you want to access doesn't exist in French.
Deutsch
The article you want to access doesn't exist in Deutsch.
Russian
The article you want to access doesn't exist in Russian.