开发者

Get Template Name - Smarty

开发者 https://www.devze.com 2022-12-20 11:33 出处:网络
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

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


Maybe the {debug} tag and its associated Debugging console could help, here ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号