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...