You are here: Re: [SMARTY] Multiple Template Directories « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Multiple Template Directories

Posted by boots on 08/23/05 05:06

--- Vonleigh Simmons <nospam@illusionart.com> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация