Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smarty: get the current physical file path

In Smarty, is there a way to retrieve the current physical path of the template file?

I'm looking for the Smarty equivalent of the PHP __FILE__ super-variable.

(I'm sure that this question must have been asked before, but I can't for the life of me find it. Or maybe there's a good reason it hasn't been asked!?)

like image 507
cartbeforehorse Avatar asked Dec 25 '22 19:12

cartbeforehorse


1 Answers

Have a look at the {$smarty} reserved variable.

  • You can get constants, using {$smarty.const.CONST_NAME}, but that will give you the compiled file's path in the case of __FILE__
  • You can get separate the directory & the file, using {$smarty.current_dir} & {$smarty.template}
like image 185
pozs Avatar answered Dec 28 '22 08:12

pozs