Dave Howorth wrote:
So I think the question is still open, if anybody knows the answer. Is
it possible to get the full path?
template.name and component.name give you the full path relative to the
location in the INCLUDE_PATH.
For example, template.name would give you something like
'products/foo.html' for the 'foo.html' file in the 'products' directory.
So if you want to do something based on which directory a file is in,
then you might do something like this:
[% path = template.name.split('/');
section = path.size > 1 ? path.first : 'default';
INCLUDE "section/$section/menu
%]
This would give you the equivalent of:
[% INCLUDE section/products/menu %] for products/*.html
[% INCLUDE section/about/menu %] for about/*.html
and so on. The above example uses the 'default' section for any
templates in the root directory, but you could make that do whatever you
like.
[% INCLUDE section/default/menu %] for *.html
There's no way to get the absolute file path to a template. That's a
feature rather than a bug. However it's likely there will be an option
in TT3 to allow you to get the absolute path if you want it.
HTH
A
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/templates