Mark
Mark

Reputation: 51

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"

Upvotes: 2

Views: 5687

Answers (2)

user180100
user180100

Reputation:

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

Upvotes: 12

Pascal MARTIN
Pascal MARTIN

Reputation: 401182

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

Upvotes: 2

Related Questions