AW: [SMARTY] Variable as array index
| From: | Georges Berscheid | Date: | Tue, 03 Dec 2002 22:45:11 +0000 |
| Subject: | AW: [SMARTY] Variable as array index | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6626@lists.php.net to get a copy of this message | ||
Have a look at the {foreach } template function.
Georges
-----Ursprüngliche Nachricht-----
Von: Duke Ionescu [mailto:duke@exhibit-e.com]
Gesendet: Dienstag, 3. Dezember 2002 23:37
An: smarty-general@lists.php.net
Betreff: [SMARTY] Variable as array index
Say I have:
$sm->assign('people', array(
array('id' => 4, 'name' => 'Duke Ionescu'),
array('id' => 8, 'name' => 'Big Lebowsky')
));
I want to do the following:
{section name=idx loop=$people}
{$people[$smarty.section.idx.iteration-1].name}<br /> {/section}
Any way to do it or do I have to do it in php?
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php