problem with hash

Author Message

Damarev .

Thursday 07 February 2008 7:28:30 am

Having a problem setting a hash.

Giving this:

{def $aHash = hash(
	'prop1' , 'A string'
)}
{set $aHash['two'] = 'Another string'}

or

{set $aHash.two = 'Another string'}

leaves $aHash empty... why?

André R.

Thursday 07 February 2008 7:48:55 am

You can not set a hash like that in templates, you have to create a new hash and use 'merge' to merge them.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Damarev .

Thursday 07 February 2008 8:28:05 am

Sorry, I made a mistake.... what I really want is to change the value of an already defined key in the hash, not creating a new one:

{def $aHash = hash( 'property' , 'A string' )}
{set $aHash.property = 'Another string' }

André R.

Thursday 07 February 2008 9:02:51 am

The template language in eZ Publish still doesn't support setting properties, so you still need to use merge.The template language in eZ Components on the other hand does ( if I remember correctly ) and it is scheduled to replace the one in eZ Publish hopefully during 2008.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Damarev .

Monday 11 February 2008 4:15:41 am

Thanks André.

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 11:42:12
Script start
Timing: Jan 19 2025 11:42:12
Module start 'layout'
Timing: Jan 19 2025 11:42:12
Module start 'content'
Timing: Jan 19 2025 11:42:13
Module end 'content'
Timing: Jan 19 2025 11:42:13
Script end

Main resources:

Total runtime0.9457 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.0391152.6094
Module start 'layout' 0.00590.0027 741.648439.4297
Module start 'content' 0.00850.9353 781.0781556.3672
Module end 'content' 0.94380.0018 1,337.445312.1875
Script end 0.9456  1,349.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3479160.0002
Check MTime0.00140.1472160.0001
Mysql Total
Database connection0.00070.071910.0007
Mysqli_queries0.890094.1160630.0141
Looping result0.00070.0710610.0000
Template Total0.911896.420.4559
Template load0.00210.224520.0011
Template processing0.909796.192520.4548
Template load and register function0.00030.035110.0003
states
state_id_array0.00120.131010.0012
state_identifier_array0.00170.180120.0009
Override
Cache load0.00180.1881220.0001
Sytem overhead
Fetch class attribute can translate value0.00070.071920.0003
Fetch class attribute name0.00270.286860.0005
XML
Image XML parsing0.00070.072820.0003
class_abstraction
Instantiating content class attribute0.00000.003970.0000
General
dbfile0.00110.1192170.0001
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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs