Re: [PHPLIB-DEV] Merge with FastTemplates From: Kristian Koehntopp (kris <email protected>)
Date: 04/02/00

In netuse.lists.phplib you write:
>The PHP Base Library comes with its own implementation of
>templates, but there is also FastTemplates
>(http://www.thewebmasters.net/). As far as I can tell, both
>implementations have exactly the same features. It would be
>very beneficial if we could close up this fork.

Template is not a fork of FastTemplates. It is a complete
reimplementation from scratch, which clears up some problems
I had with FastTemplate.

- the problem that I cannot include FastTemplates in PHPLIB
  or the PHPLIB CVS.

- the problem that FastTemplates uses ereg_replace() which
  is slow.

- the problem that FastTemplates is Perl code ported to PHP,
  which has its own special set of problems.

  Look for example how FastTemplates hogs the namespace within
  the FT object and how only the fact that all template handles
  are uppercase, but all FT internal variables are lowercase
  makes FT work at all.

  Note also, how the use of the object namespace prevents FT
  from using the faster and more flexible preg_replace().

>It's redundant and it limits the ability to share and exchange
>PHP code. Is there any chance we can work towards
>compatibility?

Not from my side. Template is cleaner, faster and more "PHP
like" in code. It is also integral part of PHPLIB and the PHPLIB
CVS. It also has some suble different semantics compared to FT,
so there is no 100% 1:1 mapping of calls, although the two are
mostly compatible.

>It would be best if at least the templates used the same
>syntax, so templates could be created one way and used no
>matter which kind of templates is used.

Template is okay for what it does and I consider it finished,
bugfixes excluded. This also is the reason why I am not
interested into a merger, whatever this merger may look like.

If you want a standardized template syntax, work with the PHP4
team on the implementation of XSLT for PHP4. This is a W3C
standard which is larger than PHP and crosses language barriers.
It is also much more powerful than PHPLIB Template or
FastTemplate.

Regexp based templates are only intermediary steps on the path
to XML/XSL/XSLT and DOM migration. They have no future in the
long term.

>Or, can anyone tell me what advantage there is to using
>FastTemplates over base library templates, or vice-versa?

I am biased, but see above for the lists of advantages of PHPLIB
Template over FastTemplates. Using compiled code templates would
be even faster, and they do have a standard API - use included
print or echo with here-documents for maximum speed and maximum
portability.

Kristian

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.