Re: {section} question
| From: | Joris Trooster | Date: | Wed, 28 Feb 2001 07:33:46 +0000 |
| Subject: | Re: {section} question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-234@lists.php.net to get a copy of this message | ||
Hi Victor,
I spend hours to do the same thing. See my postings a few weeks ago on the list. Also Graee from
Australia posted a question about this a few days ago. The answer is: it's not possible.
The answer from Andrei: "Smarty first indexes by the section iterations and then by the
associative keys (that was a design
decision that had to be made), so you'll need to restructure the array or assign a separate
array."
Maybe Andrei and Monte can think about a new design to get this to work?
Joris
NL.
----- Original Message -----
From: Victor
To: smarty@lists.ispi.net
Sent: Wednesday, February 28, 2001 12:38 AM
Subject: [smarty] {section} question
I haven't fully understood how smarty handles {sections}, so this is probably a very stupid
question.
I have an array that looks like this
[0]
[text] => Main
[children]
[0]
[text] => News
[1]
[text] => Messages
[2]
[text] => Settings
[3]
[text] => Logout
[1]
[text] => Tasks
[children]
[0]
[text] => New Program
[1]
[text] => New Version
[2]
[text] => New Customer
I would like to do a nested section, so that it loops first through the parent items and then the
child items. The code then looks somewhat like this:
{section name=parent loop=$mainmenu}
{$parent/mainmenu.text}
{section name=child loop=$parent/mainmenu.children}
{$parent/mainmenu.child.text} ; <-- error!
{/section} </td>
{/section}
The line marked "error" doesn't work. On that line, I'd like to get the
output: News, Messages, Settings, Logout and then New Program, New Version, New Customer.
Any ideas how to write that line (I've tried for one hour now and I'm getting tired of
it now).
Thanks in advance,
Victor Boivie
---
You are currently subscribed to smarty as: trooster@interstroom.nl
To unsubscribe send a blank email to $subst('Email.Unsub')
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/