On Sat, Jun 24, 2006 at 08:17:34AM +0100, Andy Wardley wrote:
> For TT3 we've thrown away the (all but useless) RELATIVE and ABSOLUTE 
> options.

I've never used ABSOLUTE.


> Relative paths will be resolved according to the location of the current 
> template.

By current template you mean relative to the location of the calling
template, not just the one passed to process(), I assume.

> 
> e.g. in product/widget/index.html:
> 
>      [% INCLUDE ./header %]          # product/widget/header
>      [% INCLUDE ../header %]         # product/header
>      [% INCLUDE ../../header %]      # header

And [% INCLUDE header %] will function as it does now -- relative to
the include path(s).

> 
> We've also got "walkup" and "walkdown" paths which look for the file in 
> any of the directories leading up/down to the current template location.
> 
>      [% INCLUDE .../header %]        # product/widget/header,
>                                      # product/header or
>                                      # header
> 
>      [% INCLUDE /.../header %]       # header,
>                                      # product/header or
>                                      # product/widget/header

Nice.  How about something silly where *all* matching files along the
path are processed.  Like how .htaccess files are processed.  I can't
imagine a use, other than overriding more general setting for
directory specific settings.

> For a short-term TT2 solution, the following MACRO does a quick-n-dirty 
> job of generating a relative path from the current component path
> 
>   [% MACRO relative(path)
>        GET component.name.remove('[^/]+$') _ path;
>   %]
> 
>   [% INCLUDE $relative('example') %]

Thanks.  In my case I'm good with it being relative to the processed
template.  It was a one-line change to my code:

    unshift @template_path, $c->stash->{static_dirname}
        if $c->stash->{static_dirname};

So [% INCLUDE foo %] now first looks in the directory of the
processed file.


Looking forward to to TT3.  Hard to imagine how great it will be
considering how nice it is working with TT2.   My daily TT2 gripes
are error reporting (in multiple statement template blocks) and that
an error in a template often means I have to restart the server so the
template can be found again.  Such a joy to work with, otherwise.

Once again, thanks!




-- 
Bill Moseley
[EMAIL PROTECTED]


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

Reply via email to