Re: [SMARTY] Smarty 2.6.0 RC1 - Change in path handling
| From: | Mark Rogers | Date: | Wed, 13 Aug 2003 11:10:07 +0000 |
| Subject: | Re: [SMARTY] Smarty 2.6.0 RC1 - Change in path handling | ||
| References: | 1 2 3 4 5 6 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10054@lists.php.net to get a copy of this message | ||
> > Granted there are other options, but the array approach is
> > the most elegant (imho)
>
> "Most elegant" is a point of view.
Agreed (I even said as much :-)
> In the array way, if you
> have some templates "index.tpl" in more than one directory,
> smarty takes the first it can find. If multiple template
> directories were defined as different strings you can
> point smarty to the template you want, even if this
> template name occure in more than one directory.
This is fine if you want to alternate between different directories
depending on circumstances (and wouldn't be affected by the suggested code
change).
What it isn't so good at is handling paths the way an operating system
does - effecively in order of preference. Yes, use the 404.tpl for this
virtual host if it has one, but if not use the default 404.tpl. Yes, render
the array of data from the database in the specific way desired by the site
designer, but until he's had chance to design it use this default template
which works but isn't pretty.
Imagine a Smarty-based application (eg a shopping cart) which came with a
complete set of standard templates but always looked in your custom
directory first; a default install would work, a customised install would
work, and if you upgrade to a new version of the shopping cart it wouldn't
matter whether the default templates had changed, your own would still
override them. (Want to go back to the defaults? Just take your custom
directory out of the search path.)
It makes it a lot easier to write standardised but customisable Smarty-based
applications, which is what I'm trying to do.
Mark Rogers,
More Solutions Ltd