[Templates] pre-compiling templates

allan lambretta@inet.uni2.dk
Sun, 12 Jan 2003 16:46:45 +0100


i guess its in the manual or somewhere in the gzipped mailing list...

bascially how do you pre-compile your templates?

from the command line with tpage or is it possible via a browser?

i had hoped that when hitting a cgi-page from a browser the first time
it would write a compiled version of the template and then use that on
any subsequent request [untill the original template changed timestamp]

the following is from a normal CGI, number 1 works as expected with no
pre-compiling; number 2 produces an empty screen and nothing in my
error log.



thanks
./allan

###
1)
my $template = Template->new({
	INCLUDE_PATH  => "$websrc/" . APACHE_ADMIN_LIB,
	PRE_PROCESS   => 'config',
});

...
...

$template->process(TT_ADMIN_HEADER, $vars)									|| $template->error();


2)
my $template = Template->new({
	INCLUDE_PATH  => "$websrc/" . APACHE_ADMIN_LIB,
	PRE_PROCESS   => 'config',
	COMPILE_EXT => '.ttc', # compile extension in same dir
});

...
...

$template->process(TT_ADMIN_HEADER, $vars)									|| $template->error();