Re: {section} question

From: Date: Wed, 28 Feb 2001 15:21:19 +0000
Subject: Re: {section} question
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-236@lists.php.net to get a copy of this message
Well, now it goes as follows: let's assume we have 3 levels of nested sections. We have to structure our data in the following way: $level1_name = array(...); $level2_name = array(array(...)); $level3_name = array(array(array(...))); and then assign them to the template: $smarty->assign($template_level1_name, $level1_name); $smarty->assign($template_level2_name, $level3_name); $smarty->assign($template_level3_name, $level3_name); The more template names, the more assigns. The more section levels, the more nested arrays. I don't like it although I already figured this out and can effectively use it. But I'd like to have something more simple and obvious. Would the following work? $names = array("name1"=>$level1_name, "name2"=>$level2_name, "name3"=>$level3_name); $smarty->assign($template_names, $names); I didn't try :-) I think it wouldn't work, but it'd be good if it did. What I'd really like (OT), is the ability of simple fetching data from database using PEAR database class. Maciek > -----Original Message----- > From: Andrei Zmievski [mailto:andrei@ispi.net] > Sent: Wednesday, February 28, 2001 3:10 PM > To: Joris Trooster > Cc: Victor; smarty@lists.ispi.net > Subject: [smarty] Re: {section} question > > > On Wed, 28 Feb 2001, Joris Trooster wrote: > > 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? > > Maybe they can. :) Is it more common, in general, to want to index by > associative keys first and then by section iterations? We can either try > to come up with a new syntax or just switch the evaluation order around > and hope it won't break too many templates. > > -Andrei > > "Man, if you gotta ask, you'll never know." > - Louis Armstrong, when asked "What is jazz?" > > --- > You are currently subscribed to smarty as: muhlig@us.edu.pl > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ > >

« previous php.smarty.general (#236) next »