RE: [SMARTY] There's a bug with {assign} combined with {foreach}
| From: | Czirbesz Endre | Date: | Wed, 02 Oct 2002 09:57:54 +0000 |
| Subject: | RE: [SMARTY] There's a bug with {assign} combined with {foreach} | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6077@lists.php.net to get a copy of this message | ||
Hi!
> -----Original Message-----
> From: Nichlas Lofdahl [mailto:crotalus@apberget.com]
> Example:
>
> bar is an array of the following format:
> $smarty->assign('bar', array('one', 'two',
> 'three'));
>
> {foreach item=foo from=$bar}
> {assign var=tmp value="foo: $foo"}
> {$tmp}<br>
> {/foreach}
>
Your code will interpret $foo as a PHP variable.
Try this way:
{foreach item=foo from=$bar}
{assign var=tmp value=$foo}
foo: {$tmp}<br>
{/foreach}
Best regards,
Endre