|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Jeremy- Smarty Rookie
Joined: 11 Feb 2005 Posts: 16
|
Posted: Thu Dec 15, 2005 7:31 pm Post subject: Looping infinate number of foreach statements |
|
|
I'm aware of the possible drawbacks of doing this, but I want to be able to loop an infitnate amount of foreach statements to print out a document tree.
Each category has a sub category, that sub category has sub categories, and that sub has more subs... etc.. I have that built in an array. Now, how do I go about looping that in smarty?
The array is something along the lines of:
Array
(
[0] => Array
(
[id] => 1
[uri] => test_forum_1
[name] => Test Forum 1
[parent_id] => 0
[sub_forums] => Array
(
[0] => Array
(
[id] => 2
[uri] => test_forum_2
[name] => Test Forum 2
[parent_id] => 1
[sub_forums] => Array()
)
[1] => Array
(
[id] => 3
[uri] => test_forum_3
[name] => Test Forum 3
[parent_id] => 1
[sub_forums] => Array()
)
)
)
[1] => Array
(
[id] => 4
[uri] => test_forum_4
[name] => Test Forum 4
[parent_id] => 0
[sub_forums] => Array
(
[0] => Array
(
[id] => 5
[uri] => test_forum_5
[name] => Test Forum 5
[parent_id] => 1
[sub_forums] => Array
(
[0] => Array
(
[id] => 7
[uri] => test_forum_7
[name] => Test Forum 7
[parent_id] => 5
[sub_forums] = Array()
)
[1] => Array
(
[id] => 8
[uri] => test_forum_8
[name] => Test Forum 8
[parent_id] => 5
[sub_forums] = Array()
)
)
)
[1] => Array
(
[id] => 6
[uri] => test_forum_6
[name] => Test Forum 6
[parent_id] => 1
[sub_forums] => Array()
)
)
)
Any help is greatly appreciated. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
Back to top |
|
Jeremy- Smarty Rookie
Joined: 11 Feb 2005 Posts: 16
|
Posted: Fri Dec 16, 2005 3:58 am Post subject: |
|
|
That looks like what I need. I'll post my questions in that thread. Thank you. |
|
Back to top |
|
|
|
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
|