RE: [SMARTY] Looping through an array in {section}
| From: | Josh Johnson | Date: | Tue, 20 Aug 2002 00:00:46 +0000 |
| Subject: | RE: [SMARTY] Looping through an array in {section} | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5766@lists.php.net to get a copy of this message | ||
Try this:
{foreach from=$items item=current}
{foreach from=$current item=this_array key=label}
{$label}: {$this_array}<br>
{/foreach}
{/foreach}
-- Josh
-----Original Message-----
From: Jorge Restrepo - WebTeam [mailto:webteam@epm.net.co]
Sent: Monday, August 19, 2002 7:42 PM
To: smarty-general@lists.php.net
Subject: [SMARTY] Looping through an array in {section}
Hello.
I have the following array nmed $items:
Array (2)
0 => Array (3)
0 => Array (6)
item_id => 1
cat_id => 1
name => name 1
url => www.url1.com
1 => Array (6)
item_id => 3
cat_id => 1
name => name 2
url =>www.url2.com
2 => Array (6)
item_id => 3
cat_id => 1
name => name 3
url => www.url3.com
1 => Array (2)
0 => Array (6)
item_id => 6
cat_id => 2
name => name 4
url => www.url4.com
1 => Array (6)
item_id => 7
cat_id => 2
name => name 5
url => www.url4.com
Now, the question is, how can i tell the smarty template to loop not
trhough $items but trhough
items[0], then trhough items[1], etc??
Thanks for your thoughts.
Jorge
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php