multidimensional arrays and foreach iterations
| From: | Jens Lehmann | Date: | Fri, 26 Apr 2002 14:24:48 +0000 |
| Subject: | multidimensional arrays and foreach iterations | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3900@lists.php.net to get a copy of this message | ||
There are two things I want to say:
1. Can I do something like $array[$var] (whereas $array is an array and $var
is a variable and a key of $array) in a Smarty Template?
{$array[$var]} and {$array.$var} didn't work: Smarty Plugin Error ...
unknown Tag $array.$var ...
2. I tried to find out the current iteration within a foreach-loop. I spent
some time on it, but only found it out when I had a look at the compiled
template.
{foreach name=test from=$array item=curr_element}
{$smarty.foreach.test.iteration}
{/foreach}
It's not _explicitly_ documented (at least I didn't find it), that's why I
suggest to do this.
Jens
PS: I'm using Smarty 2.0.1.