Re: [SMARTY-DEV] problem with dynamic vars
| From: | messju mohr | Date: | Tue, 25 Mar 2003 10:28:17 +0000 |
| Subject: | Re: [SMARTY-DEV] problem with dynamic vars | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1015@lists.php.net to get a copy of this message | ||
Hello,
On Tue, Mar 25, 2003 at 11:26:50AM +0200, WeeTzkAh wrote:
> Hello smarty-dev,
>
> I pass few awways into smarty: $array1, $array2, $array3 and so on.
> In smarty i loop another array with foreach, and i try to access the
> current array (f.g. if it`s the 2nd loop, smarty should take
> $array2). In php code, it can be ${'array'.$i} where $i - loop
> number. I tried to access in smarty {foreach
> from="$array$loop_number"..} and other combinations, but no one
> worked. :(
> Any ideas?
the presence of variable variables in php does not mean, that
everybody has to use it for obscure things that can be done much more
simple without them.
dont use 3 or n arrays. use one $array that contains all your arrays as
elements.
then do:
{foreach from=$array.$i ...}
HTH
messju