nested foreach and assign
| From: | G | Date: | Sun, 28 Apr 2002 06:22:51 +0000 |
| Subject: | nested foreach and assign | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3911@lists.php.net to get a copy of this message | ||
Hello,
Not sure what's going on here:
{foreach key=group_key item=group from=$groups}
{assign var="key" value="$group_key"}
{foreach key=var_key item=var_info from=$defaults[$group_key]}
........
{/foreach}
{/foreach}
It works as I want (even though var is "key" in the assign function and it's
not used - I was going to change $defaults[$group_key] to $defaults[$key]).
If I remove the assign function the inner foreach no longer prints out
anything. But it works again if I add the assign function again, and works
no matter what text I put in assign's var and value attributes. I also tried
using $defaults[group_key], but that didn't work.
Thanks,
Gerard