Smarty: including a template file from the same directory

Posted by Robert Munteanu on Stack Overflow See other posts from Stack Overflow or by Robert Munteanu
Published on 2010-04-26T20:38:34Z Indexed on 2010/04/26 20:53 UTC
Read the original article Hit count: 224

Filed under:
|

I have a Smarty template located in a directory under templates_dir: templates/some/dir/template.tpl . In the same directory, I have a sub-template: templates/some/dir/_component.tpl .

I can't include the sub-component using an unqualified include, since apparently it looks it up under the templates_dir:

{include file='_component.tpl'}

How can I tell Smarty to read the file from the same directory, as opposed to the templates root ? I do not want to specify absolute paths, since it will cause problems when changing directory structures.

© Stack Overflow or respective owner

Related posts about php

Related posts about smarty