Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Howto loop through array(array(array())) in a section

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Dros
Smarty Rookie


Joined: 17 Dec 2003
Posts: 7

PostPosted: Tue Feb 01, 2005 12:51 pm    Post subject: Howto loop through array(array(array())) in a section Reply with quote

Hi,

I made the following array:
Array
(
[1] => Array
(
[0] => Array
(
[kapitel] => 0024005101
[hhtitel] => 51143-785
[kstelle] => FUB
[kart] => 0
[artikel_nr] => 33
[beschreibung_k] => HP LaserJet 4300 DTN
[bemerkung] => Super Toll
[anzahl_alle] => 1
[tax] => .16
[price] => 150.00
[currency] => EUR
[a_artikel_nr] => Q2434A
[parent_wk_id] =>
[sabg_id] => 88
)

[1] => Array
(
[kapitel] => 0024005101
[hhtitel] => 51143-785
[kstelle] => FUB
[kart] => 0
[artikel_nr] => 4614
[beschreibung_k] => Vergoldung des Druckers und Kabel
[bemerkung] =>
[anzahl_alle] => 1
[tax] => .16
[price] => 3999.00
[currency] => EUR
[a_artikel_nr] =>
[parent_wk_id] => 1
[sabg_id] => 88
)

[2] => Array
(
[kapitel] => 0024005101
[hhtitel] => 51143-785
[kstelle] => FUB
[kart] => 0
[artikel_nr] => 4331
[beschreibung_k] => Zus. Papierfach für HP LaserJet 4 Serie
[bemerkung] =>
[anzahl_alle] => 1
[tax] => .16
[price] => 128.00
[currency] => EUR
[a_artikel_nr] =>
[parent_wk_id] => 1
[sabg_id] => 88
)

)

)

and don't know how to loop through it in Smarty. In PHP I'd do something like echo $my_array[1][0]['tax'], but how can I run through a 3D array with the section command? The keys of the array are not ordered, so something like foreach ist needed, which simply goes from one to another.

TIA
Alex
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Feb 01, 2005 2:34 pm    Post subject: Reply with quote

http://smarty.php.net/manual/en/language.function.foreach.php
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP