> Randal L. Schwartz <[email protected]> writes:
> Well, the brute force way is like this:

>[% master = { this_wrapper => 'master_wrapper.tt' } %]
>[%# site = { this_wrapper => 'site_wrapper.tt' %] %]
>[% this_wrapper = site.this_wrapper || master.this_wrapper %]
>[% WRAPPER $this_wrapper %]
>some wrapped stuff
>[% END %]

>Or you can simply have your master wrapper be "pluggable"...
>let them define their own sub-elements in a search path,
>so that when you WRAPPER or INCLUDE, it first looks in the
>individual template directory before searching to the
>master template directory.

Randal,

As I look through your thoughtfully provided code and plugin idea, I realize my use of the word 'wrapper' was ambiguous, and my post probably didn't clearly express my issue. Let me try to be more clear.

When creating the site template object
(
$t = Template->new), the PRE_PROCESS variable gets set to provide config info to every template, and the WRAPPER variable gets tied to my page layout file. It is this meaning of WRAPPER I was thinking of when I spoke of the "site wrapper." My concern is that since the WRAPPER layout file is set at the time of instantiation of the template object I'm not aware of a way of overriding it later on. Come to think of it, I'd also want to be albe to override the PRE_PROCESS variable in the same way.

Unless I'm mistaken, the "brute force" code would need to be incorporated in each template. But then the resulting page would still be sent during the final phase of processing to to the WRAPPER layout.

Your mention of a master "pluggable" WRAPPER sent me scurrying to the Badger book. I'll need to do some deeper reading than I have done before. I may also need to crack open TT's internal code, something I haven't yet done. I think what I'm imagining doing is something like this pseudo code:

$t = Template->new({
INCLUDE_PATH  => 'some/path',
PRE_PROCESS => { master_conf ||= $store_conf },
WRAPPER => { master_wrapper ||= $store_wrapper }});

Anyhow, thanks for the thorughts and ideas. If you have any recommended directions to look into in the code internals, I'd appreciate that.

/dennis

Reply via email to