in reply to Can a Template Toolkit template know if it has been PROCESSed or INCLUDEd?

Andy Wardley just wrote this reply on the TT mailing list:
Nope, there's nothing I can think of that will allow you to determine that from within the template. One work-around would be to INCLUDE a local BLOCK inside the template.
[% INCLUDE my_local_block %] [% BLOCK my_local_block %] .... [% END %]
It's a bit clumsy but it does at least ensure that the template markup in the BLOCK will always be protected by an INCLUDE, even if the template is loaded by a PROCESS.

xoxo,
Andy

  • Comment on Re: Can a Template Toolkit template know if it has been PROCESSed or INCLUDEd?
  • Download Code