Re: Which templatesystem should I choose?

From: Date: Sat, 16 Aug 2003 21:41:09 +0000
Subject: Re: Which templatesystem should I choose?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7253@lists.php.net to get a copy of this message
On Sat, 2003-08-16 at 11:06, Tommy Ipsen wrote: > - Templates can be saved in both the filesystem as well as in a db > (missing in xipe) As long as you can inject a string form of the template into the parser, you could use a database (hence the reason I moved to Sigma from IT). I use templates stored in a database a number of sites that use HTML_Template_Sigma (which is a superset of HTML_Template_IT). I use them merely because they're simple and I'm anal about isolation of the two sides (logic and display). I cache a serialized version of the object with the template pre-processed to save on parsing at display time... > - Nested templates (ie. templates in templates) should be allowed like > in Xipe Again, can be done with Sigma. You should be able to do it in nearly any template system either with a built-in function, or you could do it manually in your code (replace a variable with the results of processing another template - I do this on a site that uses IT). > - Caching of generated pages should be possible either built in or using > the Caching class in PEAR (Xipe supports this) I like to do this manually merely because I like to avoid as much processing as possible for page displays. Process once, display many. After all: The content is static on most sites, so why parse and process for every page view? However, most sites have user-specific processing which must be done - this negates the positive aspects of most caching systems. Therefore I cache somewhat manually, only caching the static sections of the page and compiling them all into a page when requested. There are faster systems (translating the entire page into a template), but it also requires web design that is set in stone (never is) or the re-processing of everything every time a small change is made to anything global. The purpose of filesystem caching is to save on the processing of completely static pages... > - Localisation would be nice-to-have (Xipe supports this) Store the language code with the template so you can grab the best-matching template based on the language preference order supplied by the client. > Furthermore I really liked that the template-logic was actually just PHP > code and not a new "pseudo-scripting-language" like in Smarty but this > is not essential since there is very little business logic in the templates. This goes against fiercely-held coding standards, too. The ultimate way to write unmaintainable code is to mix back-end logic and display portions together. > What is essential though is that the templatesystem should be easy to > integrate with the other PEAR packages like QuickForm, DB, Mail, Crypt, > Config, I18N and Cache. You don't code much, do you? These are libraries, not plug-in modules - you can integrate them any way you like, they're not compatible or incompatible with each-other, they exist so you don't have to reinvent the wheel and so they may be integrated by your code into a solution to your unique needs. > I hope someone can help me choose since I would rather like to avoid > spending time examining all the features of the different template > systems before choosing one. There are probably hundreds of people on this list with a hundred different preferences among them. Nobody can give you a quick and easy answer of what is absolutely right for you. In conclusion, I recommend that you look at the other three Template systems in PEAR that you haven't used yet, especially Smarty and Sigma, to see if they fit your needs. If not, edit Xipe for your needs. -- Eric

« previous php.pear.general (#7253) next »