Re: [SMARTY] Variable Variables in Smarty
| From: | Jason Sweat | Date: | Thu, 12 Jun 2003 02:19:03 +0000 |
| Subject: | Re: [SMARTY] Variable Variables in Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9707@lists.php.net to get a copy of this message | ||
From: <lmulcahy@pacbrands.com.au>
> eg.
> {foreach from=$list item=num}
> <input type="text" name="textField{$num}"
> value="{$smarty.post.textField{$num}}" />
> {/foreach}
I think you can do
{foreach from=$list item=num}
{assign var=field value="textField%s"|sprintf:$num}
<input type="text" name="$field"
value="{$smarty.post.$field}" />
{/foreach}
but I have not tested it.