Re: template engine choices (was Re: [PHP] template engine...why???)

From: Date: Thu, 01 May 2003 09:55:38 +0000
Subject: Re: template engine choices (was Re: [PHP] template engine...why???)
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-145918@lists.php.net to get a copy of this message
"Seairth Jacobs" <seairth@seairth.com> wrote in message news:20030501040636.73655.qmail@pb1.pair.com... > If you want to go even more "abstract", you could attempt to separate *all* > presentation elements into templates and template snippets, likely using > some form of str_replace() to build the final presentation. In it's simpler > incarnation, the formatting of the data itself (e.g. showing thousands > separator in a number or not) will still be embedded in the code. More > complex versions may allow additional control over the formatting from > within the templating system itself. Whichever way you go, this approach > adds more flexibility at the cost of complexity. In a sense, generating XML > and running it through XSLT would be an example of this flexibility. As > Rasmus points out, once you get to this level, you have practically > re-created PHP (ever notice just how complex XSLT can get?). TemplateTamer is closest to this approach, since your program basically have to prepare data tree that contains the data, and then engine assembles html page from templates. The important differences from xml+xslt are: 1) you prepare a data tree as php array, not a dom tree 2) you do not have to write xslt or anything similar, since TT generates necessary PHP code to handle this part of functionality. (this is also in my opinion biggest weaknes of xml+xslt: need to hack xslt, which contain both design and code) 3) There are much less "initialization" code you have to write like load this load that, call transform .. , allmost all of that is handled by TT 4) transformations done by TT engine are simpler than chores sablotron needs to endure. > So, which way should you go? It depends on all sorts of factors: > > * Your comfort level with each style of templating. > * What your application may require: > * who will be editing the presentation portions > * how complex the presentations will be > * whether processing times will be significantly affected > * etc. > * etc. > > So... if include()s work for your needs, go with it! If you later on have > a need for a different approach, go with it! As we have seen from this > thread, there is no one right answer... Yup I agree with that. rush -- http://www.templatetamer.com/

« previous php.general (#145918) next »