Re: [SMARTY] Multiple Template Directories

boots <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
--- Vonleigh Simmons <[email protected]> wrote:&#10;> > You will
find attached a file that I use on my web site. If the  &#10;> > user
has&#10;> > defined a template dir, it will be automaticaly used else
the&#10;> default&#10;> > templates are used.&#10;> &#10;>      Thank
you Vincent for attaching the file, I appreciate the help.&#10;> 
&#10;> I'm not sure this solution is going to work for me (at least how
I  &#10;> have it defined now). Reason is that the user might chose to
override&#10;>  &#10;> the "header.tpl" file, but maybe not override
the "footer.tpl". So  &#10;> smarty would error out saying that it
cannot find "footer.tpl" in the&#10;>  &#10;> user's template dir, as
he hasn't provided one.&#10;> &#10;>      I could always make it
mandatory that if you override one  &#10;> template you must provide
all (maybe copy them verbatim to his  &#10;> template folder). But this
seems a bit more of a hack, and I'd have  &#10;> to build in a whole
template management function.&#10;> &#10;>      I'd like it to work
more like $PATH does in the shell. Basically&#10;>  &#10;> that it
first searches the user template dir, and if that isn't found&#10;> 
&#10;> the template it's looking for it goes to the main one. Kinda
like / &#10;> usr/local/bin overrides /usr/bin by specifying it earlier
in the&#10;> path.&#10;&#10;&#10;I haven't been following entirely so
if someone already mentioned this, my bad. At anyrate, this is
essentially already possible, though unsupported. Simply assign
template_dir using an array of paths (ie: instead of a single string,
an array of strings) and Smarty will search each path in-order until it
finds a matching template or fails. This way you get the basic override
functionality you are describing. Again, AFAIK it is not officially
supported but I have been using it for quite some time now and for
exactly the reasons you give.&#10;&#10;best regards.&#10;&#10;&#10;> >
require_once( 'smarty_api.php' );&#10;> > $smarty = new
Smarty_custom();&#10;> &#10;>      Yep, I have smarty subclassed like
that as per the manual.&#10;


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.