Re: {php} tags and multidimensional arrays in smarty.

From: Date: Wed, 15 Dec 2004 14:12:29 +0000
Subject: Re: {php} tags and multidimensional arrays in smarty.
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12041@lists.php.net to get a copy of this message
* Rob Adams <rob_adams@hotmail.com>: > I have a situation where I need to display a variable number of shipping > address forms, depending on user input. Since there is no built in for or > while loop, I used {php}tags to setup a loop through the address forms. Why exactly don't the {foreach} and/or {section} constructs work for you? In particular, the {foreach} construct even creates iterators so you can keep track of where you are in a loop (i.e., the index). > Everything is working great, except one part: > {select name=sstate test=$ship.$addrcnt.state} > > > This is a custom function I've made, to help put the text 'selected' in the > right spot on select/option fields. Anyway, you can see what I'm trying to > do here, but it obviously doesn't work. Any way I can make this work? > Below is the line in context: > > <select name="ship[{$addrcnt}][state]" > class="listbox" > > <option value=""> Select State </option> > {select name=sstate test=$ship.$addrcnt.state} Just a haphazard guess here -- does {select} return 'selected' or '', depending on the test? If so, the above line seems like it should be within an <option> element. -- Matthew Weier O'Phinney | mailto:matthew@garden.org Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org

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