in reply to Re^2: Yet Another Stupid TT Question
in thread Yet Another Stupid TT Question
Re: Template Toolkit Cache should do the trick. It allows templates to be read from memory instead of from disk.
Update: Some code:
use Template qw( ); use Template::Provider::Memory qw( ); my %mem_drive = ( 'layout' => [ time(), <<'__EOI__' ], <p>hello, [% name %] [% content %] <p>goodbye, [% name %] __EOI__ 'somepage' => [ time(), <<'__EOI__' ], <title>Some Page</title> [% WRAPPER layout %] <p>This is the body of the page. [% END %] __EOI__ ); my $tt = Template->new({ LOAD_TEMPLATES => [ Template::Provider::Memory->new({ MEM_DRIVE => \%mem_drive }), Template::Provider->new(), ], }); my $vars = { name => 'Dave', }; my $output; $tt->process('somepage', $vars) or die($tt->error(), "\n");
The module and the var need a better name.
|
|---|