How can i generate a select list with the given year till this year? i did this
{assign var=thisyear value=$smarty.now|date_format:"%Y"}
{if !$firstyear}
{assign var=firstyear value="2003"}
{/if}
{if !$loop}{assign var=loop value=$thisyear}{/if}
<select name='{$id|default:year}' id={$id|default:year} style='width:70px;'>
{section name=yearValue max=$year start=$firstyear loop=$thisyear step=-1}
<option{if $year==$smarty.section.yearValue.index} selected="selected"{/if}>{$smarty.section.yearValue.index}</option>
{/section}
</select>
unfotunatly this produces 0 till 2003 but i want that it generates 2003 till 2010 how can i do that?
Have a look at html_select_date
{assign var=thisyear value=$smarty.now|date_format:"%Y"}
{assign var=endYear value=$thisyear+6}
<select>
{section name=yearValue start=$thisyear loop=$endYear step=1}<option>{$smarty.section.yearValue.index}</option>
{/section}
</select>
{section name=years start=2003 loop=2011 step=1}
{$smarty.section.years.index}
{/section}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With