On Thu, 24 Jan 2002, Andy Wardley wrote:

> On Thu, Jan 24, 2002 at 01:04:36PM +0000, Simon Wilcox wrote:
> > And am I correct in assuming that it is a concise form of this ?
> >
> > [%- WRAPPER page %]
> >
> > ..template stuff..
> >
> > [% END -%]
>
> Yes.  If you use the PROCESS option (or 'process' in .ttreerc) then
> TT stores a reference to the regular template in the 'template' variable
> and processes your PROCESS template instead.
>
>   my $tt = Template->new( PROCESS => 'page' );
>
> In the simple case your 'page' template can look like this:
>
>   <html>
>   blah blah
>   [% PROCESS $template %]
>   blah blah
>   </html>
>
> But often it's better to do 'page' like this:
>
>   [% WRAPPER layout;
>        PROCESS $template;
>      END
>   %]
>
> and have 'layout' look like this:
>
>   <html>
>   blah blah
>   [% content %]
>   blah blah
>   </html>

Ah !

When I have used TT2 under Apache I always processed the content and
wrapped a layout much as you have here.

If I understand this correctly now, the one line in a lib file approach
Bill suggested is a way to avoid putting the [% WRAPPER %] construct in
each content page ?

Neat.

Simon.

-- 
ENOSIG




Reply via email to