Section question

From: Date: Fri, 17 Oct 2003 03:06:23 +0000
Subject: Section question
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10365@lists.php.net to get a copy of this message
Hi all, I am having a problem with some {section} code - I've obviously done something wrong, because it seems like the section iterator does not reset. Here is the array getting assigned from the php code: $smarty->assign('Merchandise',array('links' => array($gallery_dir.'photos/merchandise/redshirt.front.jpg', $gallery_dir.'photos/merchandise/redshirt.back.jpg', ), 'thumbs' => array($gallery_dir.'photos/merchandise/thumbs/redshirt.front.thumb.jpg', $gallery_dir.'photos/merchandise/thumbs/redshirt.back.thumb.jpg', 'price' => ('$20.00'), 'description' => ('Short sleeve t-shirt comes in red and black. Sizes M - XXL'), 'category_code' => ('S'), 'product_code' => ('SST'), 'has_attributes' => ('true'), 'attr_count' => (2), 'attributes' => array('name' => array('Choose Color', 'Choose Size'), 'value' => array( array('black', 'red'), array('m', 'l', 'xl', 'xxl'), )), )); And here is my Smarty code: {if $Merchandise.has_attributes == "true"} {section name=i loop=$Merchandise.attributes.name} <INPUT TYPE = "hidden" NAME = "AttributeCode[{$smarty.section.i.index}]" VALUE = "{$Merchandise.attributes.name[i]}"> {/section} {section name=j loop=$Merchandise.attributes.name} <SELECT NAME = "AttributeValue[{$smarty.section.j.index}]"> {section name=x loop=$Merchandise.attributes.value} <OPTION VALUE = "{$Merchandise.attributes.value[j][x]}"> {$Merchandise.attributes.value[j][x]}</OPTION> {/section} </SELECT> {/section} {/if} Most of this seems to work. However, when the nested sections run through, I end up with the first combo box containing "black" and "red" as expected, but in the second combo box, I only get "m" and "l", instead of all four values. How can I write this code to get what I need? -Erich-

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