Forums / Setup & design / What did I do wrong here??? Can't describe the problem...

What did I do wrong here??? Can't describe the problem...

Author Message

Aya Brea

Friday 28 May 2004 9:36:29 am

{default sublist=10 list=array()}
{set list=fetch('content',
				'list',
				hash('parent_node_id', 2)
				)}
{section name=bit loop=$list}
{set sublist=fetch(	'content',
					'list_count',
					hash('parent_node_id', 2)
					)}
{$sublist}{* <b><--- Problem here</b>  *}
{/section}
{/default}

The $sublist variable always output default value, maybe the fetch function didn't work, maybe I have accessed wrong variable... someone please help...

Paul Borgermans

Friday 28 May 2004 1:18:32 pm

Hi

You can not use set to change variables outside the current namespace, but set-block can, see:

http://ez.no/ez_publish/documentation/reference/template_functions/variables/set_block

Although i do not see the purpose of your code sample, this should do what you want:

{default sublist=10 list=array()}
{set list=fetch('content',
				'list',
				hash('parent_node_id', 2)
				)}
{section name=bit loop=$list}
{set-block scope=root variable=sublist}
{fetch(	'content',
					'list_count',
					hash('parent_node_id', 2)
					)}
{/set-block}
{$sublist}{* <b><--- no problem here anymore i think </b>  *}
{/section}
{/default}

Have a nice weekend

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Aya Brea

Friday 28 May 2004 9:03:17 pm

This work :D

Thanks a lot Paul...

eZ debug

Timing: Jan 18 2025 18:18:43
Script start
Timing: Jan 18 2025 18:18:43
Module start 'content'
Timing: Jan 18 2025 18:18:44
Module end 'content'
Timing: Jan 18 2025 18:18:44
Script end

Main resources:

Total runtime0.9144 sec
Peak memory usage4,096.0000 KB
Database Queries58

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.9453180.8125
Module start 'content' 0.00640.8938 768.7578538.5156
Module end 'content' 0.90020.0142 1,307.273442.0547
Script end 0.9143  1,349.3281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.3193140.0002
Check MTime0.00120.1293140.0001
Mysql Total
Database connection0.00110.117710.0011
Mysqli_queries0.858893.9198580.0148
Looping result0.00050.0594560.0000
Template Total0.890897.420.4454
Template load0.00230.248820.0011
Template processing0.888597.168720.4443
Template load and register function0.00170.185010.0017
states
state_id_array0.00070.077410.0007
state_identifier_array0.00080.083920.0004
Override
Cache load0.00180.1966170.0001
Sytem overhead
Fetch class attribute can translate value0.00090.093120.0004
Fetch class attribute name0.00110.121640.0003
XML
Image XML parsing0.00120.128520.0006
class_abstraction
Instantiating content class attribute0.00000.001140.0000
General
dbfile0.00450.4927190.0002
String conversion0.00000.000830.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs