Re: [SMARTY] Smarty problem / vars vars
| From: | Robert Amos | Date: | Wed, 05 Jun 2002 14:46:10 +0000 |
| Subject: | Re: [SMARTY] Smarty problem / vars vars | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4620@lists.php.net to get a copy of this message | ||
try:
{$tabmark.$key}
and
{$tabmarknote.$key}
etc
there seems to be more success that way when using variable array keys
section of the manual that discusses referencing arrays:
http://smarty.php.net/manual/en/language.variables.assoc.arrays.html
-bok
On 5/6/02 6:53 PM, Eric Seigne banged a keyboard and produced the following
weird but readable email:
> Hello,
> i have this problem:
>
> {foreach name=eva_users item=user from=$listofusers}
> {foreach key=key item=item from=$user}
> {$tabmark[$key]}
> {/foreach}
> {/foreach}
>
> But {$tabmark[$key]} makes an error
> Warning: Smarty plugin error: [in users-mark.tpl line 25]: unknown tag -
> '$tabmark[$key]' in libs/Smarty.class.php on line 1814
>
> So how can y manage variable variable in smarty ?
> $myvar = "mytab_$i"; to use $$myvar[0][1] ....
>
> Here is an example of what i want to do (and what i do easyly with
> php-only (without smarty)
>
>
> {foreach name=eva_users item=user from=$listofusers}
> {foreach key=key item=item from=$user}
> <tr bgcolor="#ffffff">
> <td>
> {$item}
> </td>
> <td><textarea class="i" name="tabmark[note][{$key}]"
> rows="2"
> cols="40">{$tabmark[note][$key]}</textarea></td>
> <td><input class="i" type="text"
> name="tabmark[mark][{$key}]" size="3"
> value="{$tabmark[mark][$key]}"></td>
> </tr>
> {/foreach}
> {/foreach}
>
> Is that clear ? or do you want more informations about this problem ? do
> you have a solution ?
>
> Thanks in advance for your great job !
>
> Éric