[Templates] MACRO fails to show effect
Andy Wardley
abw at wardley.org
Wed May 21 19:22:02 BST 2008
Oliver Ruebenacker wrote:
> Any idea why my macro does not work?
Hi Oliver,
It's because WRAPPER is processed inside-out. So the main template is
processed first and the output is stuffed into 'content'. Then, your wrapper
template is processed. So in effect, you're defining the MACRO *after*
you've already processed the main content.
What you should do is define the PRE_PROCESS => 'macros/links' option which
will process your macro file(s) *before* processing the main template.
You could also use the PROCESS option which is like WRAPPER but works
outside-in. Instead of writing 'content', you must put 'PROCESS $template',
but then things work the right way round.
# works with PROCESS option, but not WRAPPER
[%- PROCESS macros/links -%]
[% # now go and process the main template... %]
[% PROCESS $template WRAPPER html/gen_html + structure/layout %]
HTH
A
More information about the templates
mailing list