简体   繁体   中英

Get Template Name - Smarty

I'm dealing with website is a mess and need to find out the template file that smarty is rendering.

Is there a method on the smarty template object that I can call to get the current template file?

for example

echo $tplObj->getTemplate(); // echos "shop/templates/cart.tpl"

From the doc:

{$smarty.template}

Returns the name of the current template being processed. The following example shows the container.tpl and the included banner.tpl with {$smarty.template} within both.

<b>Main container is {$smarty.template}</b>
{include file='banner.tpl'}

will output

<b>Main page is container.tpl</b>
banner.tpl

也许{debug}标记及其关联的调试控制台可以在这里提供帮助?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM