Forums / Setup & design / scope, namespace, variable, pagelayout, templates : how to ?
Nicolas OTTAVI
Saturday 28 October 2006 4:05:14 am
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.
Paul Borgermans
Saturday 28 October 2006 8:04:45 am
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
eZ Publish, eZ Find, Solr expert consulting and training http://twitter.com/paulborgermans
Wednesday 08 November 2006 2: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
*- pike
Tuesday 26 June 2007 5:15:28 am
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
--------------- The class eZContentObjectTreeNode does.
André R.
Tuesday 26 June 2007 5:27:14 am
use persistent variable to send stuff from content template to pagelayout!http://issues.ez.no/IssueView.php?Id=10956&activeItem=44
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