Harald Joerg wrote:
> I have
> [% content = PROCESS $template %]
> [% PROCESS style/${style} %]
>
> This consumes some memory, but has the advantage that from within the
> real file you can control everything including the selection of $style
> with plain TT directives.
Indeed.
I typically use a PRE_PROCESS template to define a 'page' data structure.
[% page = {
title = template.title
style = template.style or 'html'
.
.
.
}
%]
Then each template can either set META tags:
[% META title = 'My Test Page'
style = 'test'
%]
and/or manipulate the 'page' structure, which has the benefit of being
able to use dynamic data, unlike META.
[% page.title = "Home page for $user.name" %]
You can also do things like:
[% page.menu = [ ... ] %]
[% page.toc = [ ... ] %]
to define the items for a menu, or table of contents for example. If
you process the template first, as Harald shows, then these values will
be set ready for your style template to include in the user interface, e.g.
<html>
<head>
<title>[% page.title %]</title>
</head>
<body>
[% INCLUDE fancy/menu
menu = page.menu
IF page.menu
%]
# ...etc...
[% content %]
# ...etc...
</body>
</html>
A
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates