RE: [SMARTY] Looping through an array in {section}
| From: | Gary Loescher | Date: | Tue, 20 Aug 2002 04:45:49 +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-5768@lists.php.net to get a copy of this message | ||
Try this:
...
{$this_array.item_id}: {$this_array.name}<br>
...
Gary
>-----Original Message-----
>From: Jorge Restrepo - WebTeam [mailto:webteam@epm.net.co]
>Sent: Monday, August 19, 2002 8:56 PM
>To: smarty-general@lists.php.net
>Subject: RE: [SMARTY] Looping through an array in {section}
>
>
>hmmmm
>thanks
>
>this is what i get
>
>0: Array
>1: Array
>2: Array
>3: Array
>4: Array
>0: Array
>1: Array
>0: Array
>1: Array
>2: Array
>3: Array
>4: Array
>0: Array
>1: Array
>
>> -----Original Message-----
>> From: Josh Johnson [mailto:mailing_lists@allusiveimage.com]
>> Sent: Lunes, 19 de Agosto de 2002 07:01 p.m.
>> To: webteam@epm.net.co; smarty-general@lists.php.net
>> Subject: RE: [SMARTY] Looping through an array in {section}
>>
>>
>> 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
>>
>>
>>
>> --
>> Smarty General Mailing List (http://smarty.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>--
>Smarty General Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>