# The CGI::Application::Plugin::TT configuration __PACKAGE__->tt_config( TEMPLATE_OPTIONS => { INCLUDE_PATH => '/path/to/templates', WRAPPER => 'wrapper.tmpl', PRE_CHOMP => 2, POST_CHOMP => 2, }, ); # wrapper.tmpl [% WRAPPER html.tmpl + layout.tmpl; content; END; %] # layout.tmpl
##
__PACKAGE__->tt_config(
TEMPLATE_OPTIONS => {
# same as above, plus:
CONSTANTS => {
menu => [
{ text => 'Foo',
link => 'foo.html', },
{ text => 'Bar',
link => 'Bar.html', },
],
foo => 'foo!',
},
},
);
# main_menu.tmpl
- [% constants.foo %]
[% FOREACH constants.menu %]
- [% text %]
[% END %]
####
__PACKAGE__->tt_config(
TEMPLATE_OPTIONS => {
# same as the original one, plus:
PRE_PROCESS => 'config.tmpl',
},
);
# config.tmpl, in case I have to define more site-wide parameters in the future
[% PROCESS menu_def.tmpl %]
# menu_def.tmpl
[% site.menu = [
{ text => 'Foo',
link => 'foo.html', },
{ text => 'Bar',
link => 'Bar.html', },
];
%]
# main_menu.tmpl obviously becomes
[% FOREACH site.menu %]
- [% text %]
[% END %]