Re: [PHP Template] Re: [PHP3] Re: [PHP Template] Template Discussion

[email protected] ("J. M. Castagnetto") Thu, 23 Mar 2000 15:19:12 PST
Newsgroups php.template
Message-ID <[email protected]>
>From: Kristian Koehntopp <[email protected]>
>Date: Thu, 23 Mar 2000 22:57:10 +0100
>
>Thomas Jespersen wrote:
> > I have not been following this "template" discussion before, but I
> > just started looking at it today so perhaps I am wrong here, but:
> >
> > Are the templates you want to make not more or less the same as XSL?
> > http://www.w3.org/Style/XSL/
> >
> > I would certainly love to see a XSL Processor in PHP3.
>
>XSL sucks raw eggs. I have no need for sed with syntactic sugar
>or sendmail style pattern matching when I can have the full
>power of PHP. I want to parse the HTML/XML in a file into a
>document tree, then apply transformation functions written in
>PHP to that tree and dump the resulting tree to a socket.

Ah! but XSL (in particular XSLT) has its uses. If PHP acquired
a XSL/XT processor, then it will be trivial to separate the 3
components of a web application: data = XML, processing logic = PHP,
and representation = XSLT.

I for one would rather have that. It will be more interoperable in
a system that needs to use more that one processing language.
For most web application using PHP to do the logic would be fine,
but in my case that is not enough, I deal w/ molecular objects that
will be a nightmare to process in PHP straight, Java servlets help
greatly there.

That is why I am trying (now) to make use of a template/layout solution 
(very simple-minded one for now). One using XSL will be great, because I 
will not have to maintain 2 sets of layouts, one for the XML (more 
specifically CML) documents when generated from a servlet, and one for 
similar data generated (occasionally) from a PHP script.

(Hope I am making some sense, I am just getting over a flu that
knocked me out)

>As soon as I have that, I may look into a method to translate
>XSL into PHP code and execute them so that I may read XSL
>transformations as well, but that is no issue that I think is
>particularly urgent. Why learn another language with less power
>when I can achieve better results by using PHP directly?

That is a good argument for when you are developing a single web 
application, which is to work isolated from other ones.
I am thinking of a more general approach, to develop interoperative web 
application, with standard ways of calling stuff and sending data, in the 
requested format on demand.

I want to make it easy for a site that needs to list molecules in a table, 
to just request that from  my site, and my script/applet to take the data, 
apply the appropriate XSLT and send the info, and then if another site need 
the same molecules in XYZ (a real format btw), a different XSLT will be 
applied to the same data, which will be in CML.

In science there are some efforts to standarize the more than one hundred 
different structural representation formats, but it will still
take quite some time. XSLT is powerful in that context, in particular if you 
can go from a particular format to CML. Doing all possible transformations 
using only PHP will not be efficient.

>
>Kristian
>
>--
>Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
>Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
>Using PHP3? See our web development library at
>http://phplib.netuse.de/ (We have moved! Update your bookmarks!)

In my opinion, a template/layout engine like the one Andrei proposes will be 
a temporary solution to separate representation from data/logic. XSLT will 
be a permanent one.

As for the complexity of it, I cannot comment just yet, I confess that I've 
been lazy and had not read the latest specs for some time.

I better stop now, the flu medicine I took is making me very sleepy.

=====
Jesus M. Castagnetto - [email protected]
PalmPilot stuff & etc.:
  http://www.geocities.com/jm_castagnetto/
LAB: http://www.scripps.edu/research/metallo
Metalloprotein DB: http://metallo.scripps.edu/

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com