----- Original Message ----- 
From: "Perrin Harkins" <[EMAIL PROTECTED]>
To: "Chris Ochs" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 17, 2004 6:17 PM
Subject: Re: [Templates] PROCESS/INCLUDE on relative files


> Chris Ochs wrote:
> > In the meantime, I just populate a template variable with the path of
the
> > current directory so my PROCESS/INCLUDE statements look like this:
> >
> > [% PROCESS "$params.dir/header.html" %]
> >
> > Easy enough, but it's more intuitive without the params.dir bit.
> >
> > Now what I want is to have the system look for files included via
> > PROCESS/INCLUDE directives in the templates directory if they dont'
exist in
> > the catalog.  I think I will have to hack on TT a bit to accomplish that
> > though.
>
> No, you don't, you just need to put all of the directories to be
> searched, in the correct order, into your include path.  People seem to
> be constantly confused about this, so I think maybe it should be in
> giant red blinking letters at the top of the  Template docs: you can
> change the include path.  You can change it on every request.  You can
> change it hundreds of times, during a request if you feel like it.  It
> is dynamic.

Yes I did see that, but in order for it to be of use I have to go back and
change a bunch of code, which I will probably do because it looks like the
right way to do it.

We have one main include directory, and in that directory is all of our
'catalog' directories.  So let's say the INCLUDE_PATH is set to
/usr/local/catalogs.  For catalog test, I have a <Location /test > in
apache.  If I request /test/index.html, the full file/path I send to TT to
process is 'test/index.html'.  Now if test/index.html does not exist, I want
to use 'templates/index.html' instead.

Knowing what I know now, I probably should be setting the include path to
the catalog directory itself (plus the templates directory) on each request,
so that
the file I hand to TT to process would be just 'index.html', and would work
for either the catalog directory or the templates directory.







_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to