for / while loop in Smarty
| From: | Sims, Benjamin | Date: | Tue, 16 Dec 2003 11:28:55 +0000 |
| Subject: | for / while loop in Smarty | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10700@lists.php.net to get a copy of this message | ||
I feel like this should be something really obvious, but I can't work out
how to do it. I have a multidimensional array along the lines of the one
printed below. What I want to do is print a space for each level of the
menu. So, an entry in level 0 would have 1 space before it, level 1 two
spaces and so forth.
Now, since this is a section loop I have .iteration which will give the
number of spaces to print. However, I can't work out how to do:
for($iteration){
print_space
}
Any ideas as to the best way to go about this?
Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[name] => Menu entry level 1
)
)
[1] => Array
(
[0] => Array
(
[id] => 2
[name] => menu entry level 2
)
[1] => Array
(
[id] => 3
[name] => menu entry level 3
)
Benjamin Sims