">
This page shows the use of <loop> blocks in a template.
A simple loop that counts from one to ten:
<loop name="loop1" start="1" end="10">
@loop1@ </loop>
The same loop, backwards:
<loop name="loop1" end="1" start="10" step="-1">
@loop1@ </loop>
A loop, but with a step:
<loop name="loop2" start="1" end="10" step="0.7">
@loop2@ </loop>
Nested loops that print a multiplication table:
<table border="1" cellpadding="3" cellspacing="0">
<loop start="1" end="10" name="y">
<tr>
<td><input type="checkbox" name="row" checked="checked" value="@y@"></td>
<loop start="1" end="10" name="x">
<td><output name="SoupermailConf" math="@x@ * @y@"></td>
</loop>
</tr>
</loop>
</table>
Notice how the values @x@ and @y@ are expanded in the loop BEFORE the <output> element is used. This means you can use the @name@ value to specify form fields that contain numbers.
These are the rows (
Return to the examples page.
The Soupermail configuration file that made this page looks like this:
|
|
The template that made this page is looping.txt.