Loop Plugin

The only way of putting repetitive numerical values into your templates is either by hard-coding them in or by enabling and using php to do it. I always try to avoid enabling php in templates for security purposes, and hard-coding in for example a drop-down select box with 100 values is never fun.

The loop plugin works just like a simplified for loop does. It takes as parameters an initial value, an increment value, and a limit.

Here is an example of using the loop plugin to create a drop-down select box that allows the user to select the year in which they were born:

<select name="year"> 
     <option value="">Select year</option>
{exp:for_loop start="1980" end="2000" increment="1"}  
     <option value="{index}">{index}</option>
{/exp:for_loop}
</select>

Produces: