Re: PHP templates vs XML

From: Date: Mon, 29 Oct 2001 16:22:41 +0000
Subject: Re: PHP templates vs XML
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-72738@lists.php.net to get a copy of this message
On Mon, 29 Oct 2001 14:02:32 -0000, you wrote: >The idea of a template system is that the HTML code/presentation of the final view to the >user/browser, can be >devised/maintained quite separately from the PHP code required to pull data out of the back-end >db/processing/whatever. Correct? > >The systems I've looked at do this by allowing you to put 'tags' into the HTML >which are subsequently >expanded/replaced with 'real data' by the template processor immediately before >presentation to the browser. > >Now, again broadly speaking, XML allows us to define our own tags, which are subsequently ... >Correct? > >So: when would you use a template system and when would you use XML? >(and thus: on which one should I concentrate my research? ) I tend to use FastTemplate or similar systems to template most of my output - be that output HTML, Javascript - or XML. That, and the way a program is structured (collecting, processing and only then outputting it in whatever format) makes adding in different assortments of data in a variety of output formats truely trivial. In the current case, it's book information, so I collect ISBN data, which gets output. In an upcoming project, it will be news snippets - press releases and the like, where the templates will be updated and added to at will for different styles of output, as well as serialised (PHP/WDDX) and XML/RDF/Javascript output . The XML related templates of which you speak are generally XSL Templates, which are a programming language in themselves, and the XML parsing into XSL is an extensive overhead to carry. Alister

« previous php.general (#72738) next »