Forums / Developer / Global variable / Session variable
B Pierre
Thursday 06 January 2011 2:43:37 am
Hi,
I need to pass on variable from pagelayout.tpl to all templates. I have something like this in top of pagelayout.tpl :
If current_page type is X $var=current_page.valueA Else get $var
I tried to use global variable with
<u>to set value</u> {def $var="x"} {set scope="global" $var="x"} <u>to get value</u> {$#var}
but this not running...
Any idea ?
And is it possible to make session variable with eZPublish ?
André R.
Thursday 06 January 2011 2:54:09 pm
1. remember that content views are executed before pagelayout. 2. if it is a content view then you can use $persistent_variable, if you'r using ezwebin then you can use ezpagedata_set / ezpagedata_append and it will work on any module / view.3. yes, you can use session, it's available on the ezhttp function, but it's not the solution here I would say. And making use of sessions in presentation layer is a bit of a no no :)
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