For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > March 2004 > Outputting a range of years









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Outputting a range of years
Vonleigh Simmons

2004-03-27, 12:31 am

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/>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com