Re: Other directories and Smarty

From: Date: Thu, 22 Feb 2001 20:21:46 +0000
Subject: Re: Other directories and Smarty
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-197@lists.php.net to get a copy of this message
> > MO> method that involves changing smarty > MO> ------------------------------------ > > MO> We could change Smarty so that the $template_dir can take an associative > MO> array of values, like so: > > MO> $template_dir = array("/path/to/common/templates/" => "common", > MO> "/path/to/application/templates/" => > MO> "app"); > > MO> Then to include templates, you must include them like so: > > MO> {include file="common/header.tpl"} > MO> {include file="app/body.tpl"} > > MO> Smarty would then traverse all templates in every directory to compile > MO> them, and all templates would be in a subdirectory of the template > MO> directory, and must be called as such from the template. At first glance > MO> this looks doable, but may not be an easy change :-) > > Yes, that would be just a great! Especially in my case when I have > many directories with application templates and one (maybe more in the > future) shared directory with templates. I looked at the code, this will take some major reconstruction of Smarty since it uses the template directory for several things. > > MO> other ideas? > > Maybe you could change 'include' statement next way: if directory is > specified {include file="path/to/shared/templates/template.tpl"} then > first compile that template and include it from that path. If dir is > not specified then behave like it is now. This wouldn't without major replumbing either, Smarty must compile all templates up front, not at runtime of the template.

« previous php.smarty.general (#197) next »