Thomas, Mark - BLS CTR wrote:
> How do you declare a block in a top-level template, and make it available in
> a subtemplate used as a wrapper?
You don't need to do anything - the BLOCK is already available in the wrapper,
by virtue of the fact that it's defined in the calling template (main.tt).
All you need is a TRY/CATCH block in your bigtable.tt to see if mysidebar
is defined as a template (which it is in this case) or not.
--main.tt--
[% BLOCK mysidebar %]
sidebar stuff here
[% END %]
[% WRAPPER bigtable.tt %]
content
[% END %]
--bigtable.tt--
[% TRY;
PROCESS sidebar;
CATCH;
# no sidebar
END
%]
Alternately, pass the name of the sidebar BLOCK as a variable and interpolate
it in the PROCESS/INCLUDE with a leading $
-- main.tt --
[% WRAPPER bigtable.tt sidebar='mysidebar' %]
...
-- bigtable.tt --
[% PROCESS $sidebar %]
HTH
A
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates