eZ Community » Forums » Setup & design » scope, namespace, variable,...
expandshrink

scope, namespace, variable, pagelayout, templates : how to ?

scope, namespace, variable, pagelayout, templates : how to ?

Saturday 28 October 2006 1:05:14 pm - 4 replies

Hi there,

In my pagelayout, I am defining a variable.

{def $myvar=''}
{set scope='global' $myvar='myvar'}

...

{$module_result.content}

The full/folder.tpl called when I view a folder in view full, contains this (it is an override templates of node/view/full.tpl)

<h3>{$#myvar}</h3>

The problem is that this doesn't work and do not display anything. I Don't know if it is a bug or a misunderstanding of the scope concept from myself.

Can someone help me and let me know how to retrieve a variable defined in pagelayout.tpl inside .tpl that are call from the {$module_result.content} ?

Thanks,
K.

Saturday 28 October 2006 5:04:45 pm

Hi Claude

That does not work because $module_result.content is generated before the pagelayout is processed. Hence your variable $myvar is simply not defined yet in your override for node/view/full.tpl The other way around should work though.

hth

Paul

Wednesday 08 November 2006 11:10:36 am

Thanks for your answer Paul,

I did the stuff in a different way according to your answer. I've defined and set as global a variable in the template which override node/view/full.tpl.

Unfortunatly I can not access this global variable from the pagelayout.tpl. Any idea ?

Regards,
Claude

Tuesday 26 June 2007 2:15:28 pm

Same problem, no solution yet. EZP 3.7.6.

In the override template (that overrides node/view/full), I write

	{def $myvar=true()}
	{set scope='global' $myvar=true()}

In the pagelayout, I try

		test: {$myvar}
		#test: {$#myvar}

nothing ?

*-pike

Modified on Tuesday 26 June 2007 2:17:15 pm by *- pike

Tuesday 26 June 2007 2:27:14 pm

use persistent variable to send stuff from content template to pagelayout!
http://issues.ez.no/IssueView.php?Id=10956&activeItem=44

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from