[Templates] Any way to get the current Template::Document from inside a Plugin?

Andy Wardley abw at wardley.org
Thu Oct 25 20:33:32 BST 2007


John Napiorkowski wrote:
> It seems that a plugin only get's the context, but I
> can't figure out how from the context to get
> information about the current template.

Hi John,

You want to access the 'template' and/or 'component' variables.

As described here:
   http://tt2.org/docs/manual/Variables.html#section_template

Done from a plugin like this:
   $context->stash->get('template');     # main template
   $context->stash->get('component');    # current template

HTH
A



More information about the templates mailing list