Re: [SMARTY] Outputting a range of years

From: Date: Mon, 22 Mar 2004 06:37:15 +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-11160@lists.php.net to get a copy of this message
Hi, this works fine for me: <select name="year"> {section name="myLoop" start=1900 loop=2000} <option value="{$smarty.section.myLoop.index}"> {$smarty.section.myLoop.index}</option> {/section} </select> (just be aware of that the highest option will be 1999 in that example) - david > 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/> > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

Attachment: [application/pgp-signature]
« previous php.smarty.general (#11160) next »