Sunday 28 September 2008 12:56:04 pm
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
|