Re: [phplib] Object Template From: Spruce Weber (sprucely <email protected>)
Date: 09/08/00

>}...What do you think?
>
>Great idea, but I think for practical use too slow. eval() is evil.

I haven't done any performance tests, but it shouldn't be too bad since only
the call to the method is eval()ed and not the whole class declaration. This
is my first time using eval(), so I'm unsure how it would be any different
from simply including a file.

I'm sure my short snippet of code can be made more efficient, but the
eventual goal is to develop an application server where php code can be
retrieved and executed from a database. I'd think it would be better to
eval() it than trying to save it to a temporary file and include that file,
which would open up a can of worms. How does eval() perform in relation to
heavy template usage, ie. numerous pregex passes?

As it is right now, due to use of set_var(), multiple calls in a template to
one method will result in use of only the value returned by the final call
to that method.

I'm also working on block method functionality, ie...

!-- BEGIN object.method() --
{some_var}
some html
{another_var}
!-- END object.method --

This block may be parsed/appended multiple times with different values for
it's replacement fields depending on how many array elements are returned by
object.method()

The reason I'm interested in extending templates is that they can be a major
part of an application framework. I'm thinking of something similar to Zope,
but easier to learn and use and installable by someone with less than root
privileges. See phratry.sourceforge.net. It's not my project, but something
I may be contributing to.

>From: Alexander Aulbach <ssilk <email protected>>
>To: Spruce Weber <sprucely <email protected>>
>CC: phplib <email protected>, ken <email protected>
>Subject: Re: [phplib] Object Template
>Date: Fri, 8 Sep 2000 03:26:57 +0200
>
>On Tue, 5 Sep 2000, Spruce Weber wrote:
>} eval(sprintf("\$tmp = $%s->%s;", $object, $method));
>
>}...What do you think?
>
>Great idea, but I think for practical use too slow. eval() is evil. :>
>
>Have you made any performance tests with it?
>
>--
>
>SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris - (0931)22032
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>