Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
At this stage foreach loops do not set index_prev as section does.
Only iteration/first/last/total/show as per the foreach docs.
-bok
On 04 Aug 2004 10:43:01 +0200, Hiro Protagonist <hiro-@gmx.de> wrote:
> Hi,
>
> I have an array, with e.g. this keys: unit, name, phone.
> I would like to loop through the array with foreach (works fine) and
> would like to put out a extra <tr>, if the unit changes. So the output
> will be grouped by unit.
>
> I tried this:
>
> {foreach name=members from=$arrayMembers item=mem}
> {if $smarty.foreach.members.first or
> $smarty.foreach.members.index_prev.unit ne $smarty.foreach.members.unit}
> Special unit-Row
> {/if}
> Normal-Row
> {/foreach}
>
> Doesn't work.
>
> It works with sections, but i thought, doing it with foreach would make
> the code simpler. Any ideas?
>
> thx
>
> Hiro
>
> --
> Hi! I'm a .sig virus! Copy me to your .sig!
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.