Re: [Templates] ANNOUNCE: File-Find-Match 0.05 and ttree/tsite news
[prev]
[thread]
[next]
[Date index for 2004/11/13]
Leo Lapworth writes:
> There may be a way to do this in ttree, if so I haven't found it easily.
>
> On most files I want to use a pre-process (e.g. have a header
> file included for all pages). This issue is that when I run ttree
> it passes ALL files, I want to specify directories / pattern matches
> where they aren't included.
>
> I guess one could go as far as:
>
> %pre = (
> # Match => file
> 'default' => 'include/header.txt',
> '*includes*' => undef,
> '*templatedir*' => undef,
> '*/special*' => 'specific/header.txt',
> '*.tt' => 'other/header.txt',
> );
This can be done in ttree, sort of. TT can take care of it
itself because ttree passes the full path of the input file
as template.name:
PROCESS = header.txt
header.txt
-------------------------------------------
[% IF template.name.match('includes') %]
[% ELSIF template.name.match('templatedir') %]
[% ELSIF template.name.match('/special') %]
[% INCLUDE specific/header.txt %]
[% ELSIF template.name.match('.tt$') %]
[% INCLUDE other/header.txt %]
[% ELSE %]
[% INCLUDE include/header.txt %]
[% END %]
> at the moment, all my include and template files are also getting the header.txt
> added (which acutally contains a load of apache SSI stuff, rather
> than html so it doesn't break but the user gets served this from mod_perl
> passed templates and apache obviosuly has to process all the extra data in
> the static pages which have includes.
I guess many of these can be eliminated with ttree's 'ignore'
directive:
ignore = templatedir/
ignore = includes/
--
Cheers,
haj
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates