Re: Can a template tell if it has been PROCESSed or INCLUDEd?
Andy Lester <andy-U7RegYgSe6NWk0Htik3J/[email protected]> Thu, 25 Sep 2014 12:35:20 -0500
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
On Sep 25, 2014, at 12:17 PM, Kiss Gabor (Bitman) <kissg-8/[email protected]> wrote: > Just define a global variable in the outermost file: > [% SET processed = 1 %] > In the included file you will see this scalar unintialized. The point of the check is for a template that knows that it must be invoked via INCLUDE to complain if it's been invoked with PROCESS. I can't have it rely on being invoked in a certain way by the programmer because I want to check for incorrect invocations. However, that does give me an idea. Perhaps if I look for an app-wide global variable that should always exist, and it's not there, then I've been INCLUDEd correctly. -- Andy Lester => www.petdance.com _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates