[Webinar] Learn how to a build a cloud-first strategyRegister Now


Opinion Needed:  Templating Engines vs XML / XSL Output

Posted on 2007-07-26
Medium Priority
Last Modified: 2008-02-01

     I'm interested in getting some suggestions.  Right now I'm developing an architecture which does the presentation layer using templeting.  Now, my question / advice needed:  Right now I'm doing XML / XSL translation.  Part of the reason is I like the speed of using PHP's built in DOM framework, plus the output doesn't have to be HTML, I can output to whatever format I want.   However, I'm thinking of using Smarty due to its ease of use and mostly because my architecture is for the Web.  The only thing stopping me is I've heard (never fully investigated) Smarty is slow.

     My questions:  Do I stay w/ XML / XSL, move onto Smarty, or try another templeting engine.  Please give some opinons, I would really appreciate.
Question by:paulj1999

Expert Comment

ID: 19577138


If you ask me: things that make page slow are frames and too many (and) big pictures...

So if you use a CSS powered template wisely it should be pretty fast.

But as always - you will need to try it and see it for yourself.


Accepted Solution

Rurne earned 2000 total points
ID: 19578592
Stay with XSL/XML+CSS.  Smarty has similar-ish syntax to PHP, so there's no need to introduce the Smarty interpreter when you can do the same thing with proper design and native PHP.  Really, the same argument can be made for most, if not all, Web-based templating engines.

I say XSL because you can use different transforms for different media; you don't have that flexibility with the others.  While basic Web surfing might be the bulk of your userbase, you might find yourself needing to implement for the mobile-browser market, or implementing RSS/Atom newsfeeds, or providing lightweight or alternate formats for accessibility utilities like screen readers.

Really, if you don't need that degree of flexibility, then use good design principles and native PHP.  You gain nothing from a dumbed-down syntax that requires an interpreter to be compiled at run-time per page rendering.

Expert Comment

ID: 19578599
XML+XSL will run only on browsers that support them. Nowadays browsers support them but if you plan to output for palmtops, mobiles etc my vote is towards templates.

Another advantage of templates is that they give you the freedom to create code for forming the layout. Plain XML only outputs information and sometimes this is not enough.

Expert Comment

ID: 19579894
I would implement a solution like this article talks about.  Most template engines add a lot of overhead for little benefit.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question