[Templates] wrapper in control?

Randal L. Schwartz merlyn@stonehenge.com
21 Aug 2000 08:37:23 -0700


OK, what's the right framework for this?

I'm coming from Mason, and in Mason I had the ability to define
a common "autohandler" wrapper around all the things in the directory,
with a programmable header and footer possible, or even just running
some text processing on the selected file.  basically, the wrapper
has total control.

So, I define my Apache handler to look for
$r->dir_config("tt_wrapper"), and invoke that as the template,
passing the $r->filename as the file parameter.  Cool, now
wrapper gets control, and I can [% INCLUDE $file %] when I'm ready
for the body, or even [% capture = INCLUDE $file %] if I want
to post-process it.

Now, is there any way I can get TT to look for meta information in
the included file *before* I've looked at it?  I notice I can get
this with PRE_PROCESS, but there's no wait in a PRE_PROCESS to turn
off the inclusion of the body if I so choose.  I'd like to have
[% META title = 'some stuff' keywords = 'some other stuff' %] in the
"wrapped" file, and then access this in the "header" stuff of my wrapper.

Or do I need to punt and let PRE_PROCESS do this?  Can I set something
up in PRE_PROCESS so that it diverts output into a variable, and then
do something with that output in POST_PROCESS?  Can I tell TT not
to process the file at all after PRE_PROCESS?

Basically, I want my wrapper to be in control, durn it!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!