Fariz Luqman Fariz Luqman - 11 months ago 155
Smarty Question

Append .tpl when loading partials/files in Smarty

Let say that I load a partial in the template file, how can I automatically add the file extension, so when I do this

{include file='partials/head'}


it will actually do this:

{include file='partials/head.tpl'}


edit: in Mustache, I can do this:

'loader' => new Mustache_Loader_FilesystemLoader('/resources/views', ['extension' => '.tpl.php'])


so it will append the file extension straightaway

Answer Source

Without modifying the engine itself, you can't.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download