Outputting a range of years
| From: | Vonleigh Simmons | Date: | Mon, 22 Mar 2004 02:41:25 +0000 |
| Subject: | Outputting a range of years | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11159@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] <www.illusionart.com/pi/>