【发布时间】:2010-02-12 05:29:53
【问题描述】:
我正在处理的网站很乱,需要找出 smarty 正在渲染的模板文件。
我可以调用 smarty 模板对象上的方法来获取当前模板文件吗?
例如
echo $tplObj->getTemplate(); // echos "shop/templates/cart.tpl"
【问题讨论】:
我正在处理的网站很乱,需要找出 smarty 正在渲染的模板文件。
我可以调用 smarty 模板对象上的方法来获取当前模板文件吗?
例如
echo $tplObj->getTemplate(); // echos "shop/templates/cart.tpl"
【问题讨论】:
来自文档:
{$smarty.template}
返回当前正在处理的模板的名称。以下示例显示了 container.tpl 和包含的 banner.tpl,两者均包含 {$smarty.template}。
<b>Main container is {$smarty.template}</b>
{include file='banner.tpl'}
会输出
<b>Main page is container.tpl</b>
banner.tpl
【讨论】:
也许{debug} 标签及其关联的Debugging console 可以提供帮助,在这里?
【讨论】: