Forums / General / ezselection (no multiple) - how to fetch attribute values
Łukasz Serwatka
Wednesday 15 December 2004 4:01:52 am
Hi,
How to fetch all values from ezselection attribute?
{let class_attribute=fetch( 'content', 'class_attribute', hash( 'attribute_id', 231 ) )} {$class_attribute.name} //this works, give me only attribute name {$class_attribute|attribute} //this generate strange error {/let}
This is from DB
<?xml version="1.0" encoding="UTF-8"?> <ezselection> <options> <option id="0" name="value 0" /> <option id="1" name="value 1" /> <option id="2" name="value 2" /> <option id="3" name="value 3" /> <option id="4" name="value 4" /> </options></ezselection>
I need array like this
array( 0 => "value 0", 1 => "value 1", 2 => "value 2", 3 => "value 3", 4 => "value 4" )
Thanks for any help
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Thursday 16 December 2004 1:13:40 am
Nobody know? I have class where one of class attributes is ezseletion datatype. I would like to view all values of this attribute. How to do that?
Silke Fox
Thursday 16 December 2004 1:23:18 am
Hi Luke,
I think
{$class_attribute|attribute(show,2)}
should work...
I did the following to build a select list
<select name="xyz"> {section name=xyz loop=$class_attribute.content.options} <option value="{$:item.id}">{$:item.name}</option> {/section} </select>
silke
Thursday 16 December 2004 1:33:22 am
Thank you silke.
{$class_attribute|attribute(show,2)} // generate error, i report this as a bug
I use your code to generate one demensional array, thanks a lot ;-)