section loop keys / nested loops

From: Date: Wed, 09 Apr 2003 07:53:31 +0000
Subject: section loop keys / nested loops
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9196@lists.php.net to get a copy of this message
Hi all, Just starting smarty and love it so far. One trouble I have had is with nested loops. I am trying to use a piece of data from the outer loop to reference the inner array for this example OFFICES is the outer loop and CONTACTS the inner loop. each office may have multiple contacts. array format (maybe i should retrieve data differently?) $offices['id'] $offices['city'] $offices['state'] ... $contacts['office_id']['contact_id']['contact_name'] $contacts['office_id']['contact_id']['contact_phone'] ... so i want to use the current office id to loop contacts for that office. I have tried every possible option i can think of. ideally something like this: {$contacts[office.id][contact].id} the loop: {section name=office loop=$offices} {$offices[office].city}, {$offices[office].state}<br> {section name=contact loop=$contacts} -- {$contacts[office.id][contact].name} <br> {/section} {/section} thanks much, olinux __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com

« previous php.smarty.general (#9196) next »