That's great news! Exactly what I'm looking for. No wait, it's more--
the '...' idea is killer cool. B-)
Thanks Andy!
-M.
On Mon, 2007-10-08 at 10:02 +0100, Andy Wardley wrote:
> Mihai Bazon wrote:
> > I could think of one :D -- let's have the possibility to address
> > templates relative to the path of the currently running template:
>
> Yes, that's already part of TT3, although strictly speaking it's not
> part of the Provider.
>
> > RELATIVE => 1 in Template arguments is different, and it's so
> > inconvenient that I doubt that there's anyone actually using it.
>
> Spot on. TT2 RELATIVE is worse-than-useless. You'll be pleased
> to hear that both RELATIVE and ABSOLUTE options have gone in TT3.
>
> You can use relative paths in TT3 and they always resolve against the
> current template path.
>
> foo/bar/baz:
>
> [% INCLUDE ./bam %] # foo/bar/bam
> [% INCLUDE ../bam %] # foo/bam
>
> To prevent this from being misued, you can't use relative paths to
> resolve to a directory "above" your INCLUDE_PATH (which is called
> "template_path" in TT3, BTW).
>
> [% INCLUDE ../../../../etc/passwd %] # $template_path/etc/passwd
>
> You can also use "walkup" paths which find the nearest template in a
> parent directory:
>
> [% INCLUDE .../header %] # foo/bar/header, foo/header or header
>
> And "walkdown" paths which search from top to bottom:
>
> [% INCLUDE /.../header %] # header, foo/header or foo/bar/header
>
> If you want to emulate the TT2 ABSOLUTE option then you just add '/'
> to your template_path
>
> my $tt = Template->new({
> template_path => '/',
> });
>
> I'm (carefully) considering the case for this being the default
> value for template_path. That would make this work:
>
> my $tt = Template->new();
> print $tt->process('/full/path/to/template' => { pi => 3.14 })
>
> Cheers
> A
>
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://lists.template-toolkit.org/mailman/listinfo/templates
>
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates