[Templates] How to redirect template output into another file?

Simon Wilcox essuu@ourshack.com
Mon, 6 Oct 2003 10:11:16 +0100 (BST)


On Mon, 6 Oct 2003, Andy Wardley wrote:

> Simon Wilcox wrote:
> > my $tt = Template->new(
> >                 INCLUDE_PATH => 'util',
> >                 PROCESS => 'wrapper.tt',
> 
> Use the WRAPPER option:
>                   WRAPPER => wrapper.tt

<fx type="lightbulb" />
 
<snip />

> > [% FILTER redirect( opfile );
> >    wrapper = files.$dataset.wrapper;
> >    PROCESS xml/sentioquestions.tt WRAPPER $wrapper;
> >    END %]
> > 
> 
> I'm a bit lost here...

So was I :-)
 
> The idea of using an automatic WRAPPER/PROCESS template is to avoid 
> having to worry about wrappers in your main templates.

This harks back to a previous post. The template is an index page, 
generating "detail" pages on the fly. Each needs to have the same wrapper 
as the index page.

It now works a treat !

Thanks for the quick response.

Simon.