smarty2

How do I create a 'for' loop in Smarty 2?


I would like to know if it is possible to do something similar to a for cycle using Smarty 2.

I would like to have something like this:

<select>
{for $i from 1950 to 2000 }
   <option value="{$i}">{$i}</option>
{/for}
</select>

What function should I use, if any?


Solution

  • Try {section} as it is described in the smarty docs

    By the way: Check the {html_options} function: html_options docs