Just a partial answer: I think $module_result (with main content area templates) is built before pagelayout.tpl is run, so I don't think it's possible to pass variables from pagelayout.tpl to a main content area template. The reverse is possible, though.
Any variable that is defined in the pagelayout.tpl template is automatically available in all templates that are included subsequently from within the pagelayout itself (and cascading ones). eg:
{def $myvar="yes"}
{include uri="design/mytemplate.tpl"}{* myvar will be available in mytemplate*}
As Greg correctly stated, these variables will not be available in the node template, and all templates included by the node template.
The reason is twofold:
- the node template is actually executed before the pagelayout template, within one html page - the node template is not actually executed on every page view when the view cache is activated (which it should), but is only executed once every time the node content has been published
To ease passing variables from the node template to the pagelayout template, you can use the "persistent variable" mechanism. It works even with view cache on. Look it up on the docs / in the forum for more info.
Principal Consultant International Business
Member of the Community Project Board
Unfortunately that seems to be what I need: passing the variable from pagelayout.tpl to node resultig templates.
Something that, if $node_result.content is executed in first place, doesn't seem to be possible. I guess I will have to recall the database search anytime I need this data.
Thank you for the answers!
Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.
You must be logged in to post messages in this topic!