[Templates] nested wrappers and variables

Andy Wardley abw@wardley.org
Thu, 08 Jun 2006 07:50:41 +0100


Dustin Frazier wrote:
> If I try to reference the variable 'section' within a page that uses the
> 'page' wrapper, it's not defined. 

Hi Dustin,

Wrappers work "inside-out".  The inner content is processed first 
followed by the outer wrapper template.  So variables set in the main 
template are visible in the wrapper, but not the other way round.

The best general solution to this is to use a PRE_PROCESS template as 
Cees suggests.  In answer to your question, yes, the template variable 
is accessible right from the start so it's fine to put your "IF 
template.name.match(...)" code in there.

HTH
A