Re: {section} question

From: Date: Wed, 28 Feb 2001 17:50:17 +0000
Subject: Re: {section} question
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-242@lists.php.net to get a copy of this message
Maybe I was not sufficiently clear. I'd like to organize data by myself and pass them all to Smarty with only one assign call. Now the number of assign calls is equal to the number of template variables and I find this assigning slightly inconvenient. Maciek > -----Original Message----- > From: Andrei Zmievski [mailto:andrei@ispi.net] > Sent: Wednesday, February 28, 2001 5:13 PM > To: Maciek Uhlig > Cc: smarty@lists.ispi.net > Subject: Re: [smarty] Re: {section} question > > > On Wed, 28 Feb 2001, Maciek Uhlig wrote: > > 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); > > Well, this would assign three template variables. What did you try to do > with this? > > -Andrei > > "Later in this talk, I intend to define > the universe and give three examples." -- Larry Wall >

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