[Templates] Passing $context to the providers, good or bad idea?

Yann Kerhervé yann.kerherve at gmail.com
Tue Feb 19 19:35:57 GMT 2008


On Feb 19, 2008 9:54 AM, Perrin Harkins <perrin at elem.com> wrote:

> On Feb 18, 2008 3:07 PM, Yann Kerhervé <yann.kerherve at gmail.com> wrote:
> > My users can write templates (kind of...) and specify [% INCLUDE
> > 'my:header.tt' %]
> >  I want my provider to know that 'header.tt' comes from one specific
> user
> > and not another (to be able to load the correct one).
>
> I'd probably handle that by changing the include path rather than
> using a custom provider.  You can either set the include path before
> you call process() or try making a generator.


Yeah, I thought about that but it looked more complicated with the TT
singleton instance I'm using, and less flexible (I probably wouldn't be able
to change the user in the template ([% user = my_other_user %]).

I'll give it a try and keep you posted.

Thanks,

Yann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080219/ba2ab4c8/attachment.htm 


More information about the templates mailing list