Forums / Setup & design / Accessing attributes by name in $content_attributes

Accessing attributes by name in $content_attributes

Author Message

Hakim Bouras

Thursday 29 November 2007 9:32:45 am

Hi,

I would like to personalize "edit" templates, and for this I do not want to loop through $content_attributes as it is usually done.

How can I access an attribute <b>using its name</b> ?

I already tried to access it through $object.current.data_map.<attribute_name> but this way, when there is an error in the validation of the form, the fields that were initially filled before submitting the form are empty.

Do you have any idea to avoid a hard coded solution such as:

set $my_name=$content_attributes[0]
set $my_user_account=$content_attributes[1]
set $my_address=$content_attributes[2]
(...)

Thank you for your help,
Hakim

eZ debug

Timing: Jan 19 2025 11:40:44
Script start
Timing: Jan 19 2025 11:40:44
Module start 'content'
Timing: Jan 19 2025 11:40:45
Module end 'content'
Timing: Jan 19 2025 11:40:45
Script end

Main resources:

Total runtime1.3979 sec
Peak memory usage4,096.0000 KB
Database Queries47

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.1016180.8125
Module start 'content' 0.00631.3852 769.9141439.9766
Module end 'content' 1.39160.0063 1,209.890638.0703
Script end 1.3979  1,247.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.1998140.0002
Check MTime0.00120.0877140.0001
Mysql Total
Database connection0.00070.048010.0007
Mysqli_queries1.360097.2856470.0289
Looping result0.00040.0312450.0000
Template Total1.361797.420.6808
Template load0.00230.164420.0011
Template processing1.359397.240320.6797
Template load and register function0.00010.008510.0001
states
state_id_array0.00190.137310.0019
state_identifier_array0.00290.205920.0014
Override
Cache load0.00170.1233120.0001
Sytem overhead
Fetch class attribute can translate value0.00070.051710.0007
Fetch class attribute name0.00060.041720.0003
XML
Image XML parsing0.00140.099510.0014
class_abstraction
Instantiating content class attribute0.00000.000320.0000
General
dbfile0.00320.2260180.0002
String conversion0.00000.000530.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs