Forums / Developer / Ezselection problems. / Comment42930
Craig Hirsch
Wednesday 20 April 2005 12:55:07 pm
I believe the ezselection datatype stores just the NUMBER of your selection. In other words, 0 if you select the first option on the admin side, 1 if you select the second, and so on.
From some code of mine, in which I used a selection datatype to record the specific image alias I wanted to apply in a given case:
{* Determine user-selected image alias to apply, 300px is default *} {switch match=$node.data_map.primary_product_image_width.content.0} {case match=0}{set scope=root product_image_alias='300px'}{/case} {case match=1}{set scope=root product_image_alias='200px'}{/case} {case match=2}{set scope=root product_image_alias='400px'}{/case} {case match=3}{set scope=root product_image_alias='500px'}{/case} {case match=4}{set scope=root product_image_alias='fullwidth'}{/case} {case}{set scope=root product_image_alias='300px'}{/case} {/switch}
As you can see, since it's a SINGLE selection, we access the value by referencing the 0 element in the array. If it were a multiple selection, there might be more elements in the array.
-- chirsch{AT}gmail{d.t}com