Chris Ochs wrote:
> I'm trying to pull in a header.html file from the same directory using this:
> 
> [% PROCESS './header.html' %]

I see you've already discovered why this isn't working as expected.
'.' refers to the current working directory and is entirely unrelated
to wherever the template came from.

I think this has to be one of the most useless and badly conceived
features in TT.  Why on earth I made it like that I will never know.

I'm fixing it in TT3.  The problem in TT2 is that templates don't know
where they came from.  So unless index.html knows that it came from 
/usr/local/templates/foo, there is no way to know that './header' should
also come from the same directory.

In TT3 each template will know where it came from.  This will allow you
to use relative files and have them work as expected:

   [% PROCESS header %]     # any header
   [% PROCESS ./header %]   # header in same directory
   [% PROCESS ../header %]  # header in parent directory

It should also make it possible to automatically walk up (or down) the 
INCLUDE_PATH from the current location to find files.

  [% PROCESS header %] => [% PROCESS ./header %]
                       or [% PROCESS ../header %]
                       or [% PROCESS ../../header %]
                       etc.

And finally, I'm also planning to add the equivalent of Mason's 
autohandlers and dhandlers, except that they will be called more 
TT-ish names like 'process' and 'wrapper'.

All these things should make template management easier.  

A


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

Reply via email to