Re: [SMARTY] Relative includes?
| From: | Monte Ohrt | Date: | Tue, 21 Dec 2004 17:30:49 +0000 |
| Subject: | Re: [SMARTY] Relative includes? | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12069@lists.php.net to get a copy of this message | ||
Dieter Erdmann wrote:
Hi,Why not do something like: $theme = 'foobar'; $smarty->assign('theme', $theme); $smarty->display("$theme/index.tpl"); Then in the templates: {include file="$theme/header.tpl"} Basically, keep your separate "themes" under subdirectories and access them with an assigned "theme" variable. That will keep things easier to manage and less error-prone. Multiple template dirs introduce new file management issues and compiled file issues (you must make a separate compile_dir per template_dir or manage unique compile ids) MonteHmmm the whole point is actually to have a directory hierarchy in my project. I don't want to put all templates in the same directory... cu Dieter{ include file="subdir/inc.tpl"; } It seems that the include path is always relative to the 'templates' root directory instead of the current directory (i.e. the directory of the current template). Is there a way to get local includes working?Make the subdir your Smarty template dir.