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

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 19 2025 01:23:06
Script start
Timing: Jan 19 2025 01:23:06
Module start 'layout'
Timing: Jan 19 2025 01:23:06
Module start 'content'
Timing: Jan 19 2025 01:23:06
Module end 'content'
Timing: Jan 19 2025 01:23:06
Script end

Main resources:

Total runtime0.6474 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.3828152.6406
Module start 'layout' 0.00510.0027 742.023439.4766
Module start 'content' 0.00780.6381 781.5000434.8828
Module end 'content' 0.64590.0014 1,216.38288.1250
Script end 0.6474  1,224.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.6923160.0003
Check MTime0.00260.4009160.0002
Mysql Total
Database connection0.00100.151710.0010
Mysqli_queries0.604193.3178460.0131
Looping result0.00050.0769440.0000
Template Total0.611494.420.3057
Template load0.00360.550220.0018
Template processing0.607993.893620.3039
Template load and register function0.00010.016110.0001
states
state_id_array0.00140.215310.0014
state_identifier_array0.00100.147120.0005
Override
Cache load0.00310.4829120.0003
Sytem overhead
Fetch class attribute can translate value0.00080.120210.0008
Fetch class attribute name0.00120.180420.0006
XML
Image XML parsing0.00050.082810.0005
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00170.2634160.0001
String conversion0.00000.001540.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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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