RE: The problem with Smarty
| From: | Monte Ohrt | Date: | Sun, 17 Feb 2002 09:18:34 +0000 |
| Subject: | RE: The problem with Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2704@lists.php.net to get a copy of this message | ||
Two comments:
1) Use the right tool for the job. Smarty may not be well suited for every
application, use what is going to make the most sense. I doubt it will ever
be the end-all be-all template language for every situation. I'm sure it is
overkill for many simple applications that just don't require the breadth of
functionality it brings.
2) You should never have to edit the Smarty class files themselves. Always
keep them as-is so to upgrade you simply drop the new files into place. Of
course it is easier to have one central installation of the library files,
just put them in your include_path. For each application, you create a new
instance of the class. Something like this:
myapp_setup.php
---------------
include("Smarty.class.php");
class Myapp_Smarty extends Smarty {
// call constructor
$this->Smarty();
// setup Smarty configs for your app
$this->template_dir = './my/path/to/templates';
$this->caching=true;
}
index.php
---------
include("myapp_setup.php");
$smarty = new Myapp_Smarty;
$smarty->display('index.tpl');
> -----Original Message-----
> From: Peter Bowyer [mailto:reywob@f2s.com]
> Sent: Sunday, February 17, 2002 3:00 AM
> To: smarty@lists.ispi.net
> Subject: [smarty] The problem with Smarty
>
>
> Hi,
>
> Now I'm not knocking the Smarty template engine, as I know how good it is
> to use, and how well written it is. With that proviso in mind, read on...
>
> I would love to convert my open source scripts such as sendcard to using
> Smarty. The problem is that Smarty requires a relatively high level of
> technical knowledge to get it working. With phpLib templates the
> end user
> doesn't have to do anything - they just run the script that includes the
> template class and it works. With Smarty, a minimum of 5 paths need
> modifying in Smarty.class.php and two folders need chmoding. Also, with
> Smarty the question arises as to whether it's better to have one central
> installation or many separate ones distributed with the script.
> The latter
> is obviously easier to set up, but with the amount of disk space that
> Smarty occupies (compared with, say, phpLib's templates) the former makes
> more sense.
>
> Has anyone any suggestions as to how to get round these two
> problems (short
> of telling the newbie users to b***er off)? For Smarty to become more
> widespread I feel that an easier installation system will have to be
> devised - quite how I don't know. Even if it was distributed
> with PEAR the
> paths would still have to be changed (./cache, ./templates_c etc
> don't work
> for me - they make a separate folder in the directory containing my PHP
> scripts - and this is using require_once).
>
> Regards,
> Peter.
>
> ---oOo---
> sendcard - *The* PHP e-card solution
> http://sendcard.sf.net
> ---oOo---
>
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/ž7>Ì
> °Kã 5Lµ$