[Templates] Beginner Question: A way around absolute paths?
Axel Gerstmair
Axel Gerstmair <anthill@web.de>
Thu, 16 Oct 2003 13:04:57 +0200
Hello Kip!
On Thursday, October 16, 2003 at 08:41, Kip Lawrence wrote:
> [...] I am trying to decide how best to write my templates.
> Currently I have three files... header, footer, and index.tt2. The
> extension .tt2 is routed to Apache::Template.
> In the Apache error_log I see the following:
> ----------
> [error] access to
> /home/httpd/sites/d/e/devstore.pmgmentors.com/index.tt2 failed for
> 000.000.000.000, reason: file error - header: not found
> ----------
Use include paths to specify where your template files are located.
When you are using Apache::Template, you can specify one or more
include paths in your httpd.conf via the TT2IncludePath directive,
e.g.
TT2IncludePath /usr/local/tt2/templates
When you are using Template Toolkit directly, you can specify the
include paths at creation of the template object, e.g.
my $template = Template->new({
INCLUDE_PATH => '/usr/local/tt2/templates',
});
Please have a look at the Perl documentation of Apache::Template
[1] and Template Toolkit [2], where things are explained in more
detail and examples are given.
Best regards,
Axel
[1] perldoc Apache::Template -or-
http://www.template-toolkit.org/download/Apache-Template-0.08/README
[2] perldoc Template::Manual::Config -or-
http://www.template-toolkit.org/docs/default/Manual/Config.html