Re: Can a template tell if it has been PROCESSed or INCLUDEd?

Andy Wardley <[email protected]> Thu, 25 Sep 2014 17:25:02 +0100
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <[email protected]>
Hi Andy

> Is this possible to do in TT?

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.

Cheers
Andy