Re: [SMARTY] Variable variables in templates?
| From: | messju mohr | Date: | Sun, 16 Mar 2003 06:29:14 +0000 |
| Subject: | Re: [SMARTY] Variable variables in templates? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8673@lists.php.net to get a copy of this message | ||
On Sun, Mar 16, 2003 at 12:38:51AM +0100, Nagger wrote:
> Hello...
>
> Is there a way to handle variable variables in templates?
>
> Now I write:
> {if $i == 1}{$smarty.capture.foo1}
> {elseif $i == 2}{$smarty.capture.foo2}
> {elseif $i == 3}{$smarty.capture.foo3}
> {elseif $i == 4}{$smarty.capture.foo4}
> {elseif $i == 5}{$smarty.capture.foo5}
> {elseif $i == 6}{$smarty.capture.foo6}
> {elseif $i == 7}{$smarty.capture.foo7}
> {elseif $i == 8}{$smarty.capture.foo8}
> {/if}
>
> But something like that would be nicer:
> {$smarty.capture.foo$i}
{assign var=foo_i value="foo_$i"}
{$smarty.capture.$foo_i}
should do.
> I tried different things with "assign" and "eval" but nothing works :(
>
> Bye...
> Nagger