Re: [PHP3] Re: [PHP Template] Re: [PHP3] PHP Template Engine spec revision 0.52

[email protected] (Auke van Slooten) Tue, 21 Mar 2000 13:52:55 +0100 (CET)
Newsgroups php.template
Message-ID <Pine.LNX.4.10.10003211342340.28666-100000@ringbreak.dnd.utwente.nl>
On Tue, 21 Mar 2000, Zeev Suraski wrote:

> I'll try to say why I think it's actually very bad for PHP to have a
> powerful template engine, and why it's not harmless.
> 
> The way I see it, if the templates engine actually gets implemented
> successfully, then people would see it as an integral part of the
> language.  Now, some would think it's better to use, and some won't.  The
> thing is, you would now have two very very different ways to implement
> your logic.  Essentially, two different languages in the same package.
> 

<snip>

> I would really like to hear from people whether they think I'm just being
> 'paranoid' about introducing a complete new syntax set for PHP being a bad
> thing.  If my thoughts are correct, then this discussion does belong here,
> because as I said, in a year's time or so, it'll affect every single PHP
> developer out there.
> 
> Zeev
> 

Hi,
  I've watched this spec grow with mixed feelings too. I'm developing a
rather complex system in PHP. I want people to be able to have a big
influence on how parts of this system behave and display, but I don't want
them to be able to read my password file, or access the database via
generic php functions. So I really need something like a template system,
only there were no systems powerfull enough. The solution I've chosen
right now is to create a script which rewrites normal php code so that
'dangerous' (not in the list of 'safe' functions) functions are mapped to
an object. If the function is available there, it will run, if not, it
will fail. It does the same with variables. Now, the current
implementation of this translater is not very pretty, and I would like to
use something cleaner, but I agree with Zeev that the spec as I've seen it
now only serves to let people learn yet another language. If you need this
power, it is in my opinion much better to familiarize people with the php
way of coding. This way you will have the added bonus of introducing
people to PHP programming, instead of <insert template language here>.
Still, in my case it would be nice if there was a foolproof way of
creating a sort of sandbox in php.

Auke van Slooten
http://www.muze.nl/

PS. the translator is available at
http://www.muze.nl/software/tools/pinp.html