RE: [SMARTY] Outputting a range of years
| From: | Erich Beyrent | Date: | Mon, 22 Mar 2004 14:48:29 +0000 |
| Subject: | RE: [SMARTY] Outputting a range of years | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11163@lists.php.net to get a copy of this message | ||
> Hello,
>
> I was checking through the manual but didn't find anything
> appropriate, how would you output a range of years, say from 1960 to
> the current year?
>
> It's for a form where they need to select a year, this is the
intended
> output:
>
> <label>Year:
> <select name="year">
> <option value="1960"> 1960 </option>
> <option value="1961"> 1961 </option>
> ...
> </select>
> </label>
>
> I was hoping to use a while construct, using
> {$smarty.now|date_format:"%Y"} as the final year. Is the solution to
do
> it in PHP and pass smarty an array? I was hoping there was a better
way.
>
>
> Vonleigh Simmons [vanlei]
Why not just use {html_select_date}?
http://www.phpfreaks.com/smarty_manual/page/language.function.html.selec
t.date.html
-Erich-