Tony Bowden wrote:
> Hmmm. I suspect this might make slightly more sense if was more apparent
> what $foo, $bar, $baz and $wiz might actually be... Are these instances
> of Template::Provider (or appropriate subclass)?
Sorry, yes, they are.
> Does this work dynamically?
>
> i.e. can you do [% INCLUDE $provider:hello.tt2 %]
No, not in TT2. I don't think it'll work in TT3 either. Well, maybe.
> I have a feeling that this could be a very useful thing, but haven't
> quite worked out how yet :)
In TT2 it allows you to have different providers that either use
different mecahnisms to fetch the template:
[% INCLUDE file:header %]
[% INCLUDE dbi:header %]
or that have different INCLUDE_PATH options
[% INCLUDE standard:header %]
[% INCLUDE custom:header %]
In TT3 it will be a more generic way of accessing a resource of some
kind.
[% somefile = file:header %]
[% someuser = user:fred %]
[% somexml = xml:product.xml %]
The provider hides the detail of how a particular resource (file, data
structure, database record, whatever) is provided so that you don't have
to put messy implementation details in your templates.
In TT3 you will also be able to assign to a resource, triggering the
underlying provider (or separate consumer) to magically store the resource.
[% file:product.html = INCLUDE product/info %]
[% user:tom = {
name = 'Tom'
email = '[EMAIL PROTECTED]'
}
%]
In summary, it provides a general mechanism for fetching and storing data
without having exposing the implementation.
A
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates