Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

smarty2

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?

like image 217
nunos Avatar asked Dec 16 '22 15:12

nunos


1 Answers

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

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

like image 165
Roman Avatar answered Jan 25 '23 05:01

Roman