Get name of the current template file

Posted by Prem Tiwari | Updated on

You could set a global variable during the template_include filter and then later check that global vairable to see which template has been included.

You naturally wouldn’t want the complete path along with the file, so i’d recommend truncating down to the filename using PHP’s basename function.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers