Re: Which templatesystem should I choose?
| From: | Markus Wolff | Date: | Sat, 16 Aug 2003 20:13:39 +0000 |
| Subject: | Re: Which templatesystem should I choose? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7252@lists.php.net to get a copy of this message | ||
Tommy Ipsen wrote:
Hi I've used Template_Xipe for a while now but it's not possible to save templates to a database which is a feature I badly need! Therefore I have to switch to one of the other templatesystems available and would like some help choosing between them!Hi Tommy, instead of helping you to switch to another template system (which undoubtedly would lead to another of these religious template engine wars), I´ll give you some other hints how you can proceed: 1. This is open source. You can always ask the author of the template if he can implement this or that little feature for you. Sometimes the authors of packages are nice (or just think it´s a good feature to include for all users) and do it. Sometimes, they might ask for money to include it. Sometimes they may think the feature you want stinks and will never implement it. The point is: It can´t hurt to ask. 2. This is open source. If the author doesn´t want to implement your feature or doesn´t have time to do it, you can always read the openly available code, see what´s needed to implement the feature and then do it yourself. You can then present the ready-made feature to the author of the original package in the form of a patch. If he doesn´t want to include your patch, you can simply extend the original class and use your own extended version. Because you´re making use of inheritance you won´t miss any bugfixes or new features in the original package nonetheless.
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.Business logic should never ever be in templates, which is the point of using templates in the first place. If you absolutely need *display* logic in the template that goes beyond hiding/displaying specific template blocks, then you should not use a template engine at all, but just inlude() PHP files (or eval() strings coming from a database, if you must) that contain HTML code and any *display* logic you want. It can´t get any faster or simpler than that.
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.That should be true for all of them. Regards, Markus