Re: [SMARTY] cycle?
| From: | Jason Sweat | Date: | Sun, 16 Jun 2002 13:32:37 +0000 |
| Subject: | Re: [SMARTY] cycle? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4879@lists.php.net to get a copy of this message | ||
untested, but should work:
in php
for ($i=10; $i<91; $i++) {
$val[$i] = $i;
}
$t->assign(val, $val);
in template
<select name="age">
{html_options options=$val}
</select>
or make a section that does:
<select name="age">
{section name=s start=10 loop=90}
<option value="{$smarty.section.s.index}">{$smarty.section.s.index}</option>
{/section}
</select>
Jason
----- Original Message -----
From: "Mattia Wow" <nocciolo@yahoo.com>
To: <smarty-general@lists.php.net>
Sent: Sunday, June 16, 2002 6:12 AM
Subject: [SMARTY] cycle?
> Hi I have to write am HTML like this:
>
> ...
> <input type="select" name="age">
> <select value="10">10</select>
> <select value="11">11</select>
> <select value="12">12</select>
> <select value="13">13</select>
>
> [...]
>
> <select value="90">90</select>
>
> </input>
>
> So I have to cycle from 10 to 90, otherwise write by
> hand a lot of values. So I was wandering if there was
> some smarty function that can do this for me, without
> using my php script. The {cycle} function doesn't seem
> to be suitable. Any hints?
>
> Mattia
>
> ______________________________________________________________________
> Corri in negozio! Ti aspetta il CD originale Levi's Freedom to Move.
> Per saperne di più:
http://it.yahoo.com/mail_it/foot/?http://it.promotions.yahoo.com/levis
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>