Re: A bug in section loop
| From: | Andrei Zmievski | Date: | Tue, 17 Jul 2001 13:19:13 +0000 |
| Subject: | Re: A bug in section loop | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1178@lists.php.net to get a copy of this message | ||
On Tue, 17 Jul 2001, Ivo Jansch wrote:
> Would it not be nice if you could support non contiguous arrays as well?
> It's quite easy. You just have to change your loop a bit.
>
> Instead of a 'normal' loop, like
>
> for($i=0;$i<count($array);$i++)
> {
> echo $array[$i];
> }
>
> you could do:
>
> foreach($array as $key => $value)
>
> {
> echo $value;
> }
>
> This way you could even loop associative arrays..
Trust me, if it were that easy, I would have already done it. ;-) The
problem is that with foreach() approach you are limited to looping
through only one array, whereas {section} needs to support looping
through several. Having said that, I'm still thinking about how to make
it work.
-Andrei
The Heineken Uncertainty Principle:
You can never be sure how many beers you had last night.