Re: Smaller Size?
| From: | Monte Ohrt | Date: | Wed, 23 Jan 2002 19:45:29 +0000 |
| Subject: | Re: Smaller Size? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2572@lists.php.net to get a copy of this message | ||
Hi Brian,
As for add-ons, I'm speculating a good part of the code will be
modularized with plug-ins. Andrei has that task on his TODO list, I'm
not sure how close he is to looking at it.
As for other things, it isn't terribly easy to pull everything apart
since PHP does not (yet) support the ability to dynamically add methods
to classes. We already did this somewhat by pulling out the compiling
code to another script and extended the class when it was needed. You
can see that this is not as clean as we would like it to be. There are
other work arounds too, there is a nice class in PEAR to emulate adding
methods, but it does create a performance impact which is something want
to avoid. When PHP does support adding methods to classes, we'll look at
that again.
Another alternative would be to make a stripped down version of Smarty,
then you get into an issue of what stays and what goes, and who is going
to support it. You're always welcome to strip out whatever you don't
want for your own needs. Not a long term solution, I know.
Monte
"Brian E. Lozier" wrote:
>
> Is it possible to make Smarty more compact and "modularized?" What I mean
> is, it seems like a very large class (over 1500 lines), most of which
> doesn't seem to get used on a typical page, especially once the app is in
> place.
>
> It seems like you could do the same with other functions as you have with
> the compiler class - make different classes for the config, caching, etc.,
> all included only if they're needed for a specific page.
>
> Like, I never use config files, or these strange function things you have
> written in all over the place (to allow people to add their own functions,
> maybe?), or these 'addins,' debugging, or any other strange functions.
>
> I don't use anything (unless it's called internally) from the custom_funcs
> or the custom_mods.
>
> It seems like Smarty is touted as being all fast, which is probably true,
> but it could be faster if it didn't load so much in the class itself.
>
> if($this->caching) {
> // include class.smarty.cache.php
> }
> if($this->debug) {
> // include class.smarty.debug.php
> }
>
> It just seems like 1500 lines for the base class, and over 800 for the
> addins class, all loaded each and every time a smarty page is called, seems
> a bit excessive. Especially if the template is already cached/compiled and
> you don't need any of the other stuff that's included with the class.
>
> ---
> 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/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/