loop is used to create a numeric loop.
The arguments to loop are the starting number, the
ending number, and the step. ClearSilver will always evaluate the loop
expression to guarantee that it will finish. For instance, if you use a
negative step value, but the ending number is greater than the starting
number, ClearSilver will automatically switch the starting and ending
numbers. The expressions are only evaluated once, so changing the
variables in the loop will have no affect. Some quick examples:
<?cs loop:x = #1, #5, #2 ?><?cs var:x ?>, <?cs /loop ?>
1, 3, 5
<?cs loop:x = #1, #205, #2 ?><?cs var:x ?>, <?cs /loop ?>
1, 3, 5... 205
backwards
<?cs loop:x = #205, #1, "-2" ?><?cs var:x ?>, <?cs /loop ?>
205, 203, 201, ... 1