ezselection (no multiple) - how to fetch attribute values

Author Message

Ł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

Łukasz Serwatka

Thursday 16 December 2004 1:13:40 am

Hi,

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?

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

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

Łukasz Serwatka

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 ;-)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 20:52:35
Script start
Timing: Jan 18 2025 20:52:35
Module start 'layout'
Timing: Jan 18 2025 20:52:35
Module start 'content'
Timing: Jan 18 2025 20:52:36
Module end 'content'
Timing: Jan 18 2025 20:52:36
Script end

Main resources:

Total runtime1.1405 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1250153.4688
Module start 'layout' 0.00630.0042 742.593839.4219
Module start 'content' 0.01051.1286 782.0156557.4688
Module end 'content' 1.13910.0013 1,339.484412.1094
Script end 1.1404  1,351.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2639160.0002
Check MTime0.00120.1036160.0001
Mysql Total
Database connection0.00090.083010.0009
Mysqli_queries1.077794.4982600.0180
Looping result0.00100.0855580.0000
Template Total1.094796.020.5473
Template load0.00210.184120.0010
Template processing1.092695.797920.5463
Template load and register function0.00010.009310.0001
states
state_id_array0.00150.133910.0015
state_identifier_array0.00160.140020.0008
Override
Cache load0.00180.1587430.0000
Sytem overhead
Fetch class attribute can translate value0.00050.046820.0003
Fetch class attribute name0.00160.138350.0003
XML
Image XML parsing0.00070.057720.0003
class_abstraction
Instantiating content class attribute0.00000.001970.0000
General
dbfile0.00080.0670180.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs