views:

42

answers:

2

Hi there,

I am looking for a good template system (preferably XML-based) that provides implementations both for PHP and Javascript.

This would enable me to write templates for some elements that are either: - Populated on server side : when simply displaying those, in "reader" mode. - Or instantiated / populated on client side : when creating new instances of these objects, in the admin backend, using Javascript.

Do you have such a template system ? Or maybe an alternative to handle those needs ?

Thanks in advance,

Best regards, Raphaël

A: 

Xslt? Not all browsers support it, but a good majority do.

Robin
To me, XSLT has several drawbacks :* It only transforms XML data, not native hierarchy of objects.* It is ugly and super-verbose* I would have to struggle with the different bugs / implementation of all browsers. I definitiely need some separate library that has been tested and enforced against most browsers.
Raphael Jolivet
Ugly and super verbose?! Don't believe the fanyboi hype, XSLT is a succinct and powerful tool in it's own right. This may not be the best way to use it, but at least it satisfies most of the criteria in your question - I reckon it's the only templating language that is *natively* supported on most browsers.
Robin
+1  A: 

It is not XML-based, but the only one I know available in JS and PHP is mustache, which is a fairly simple template engine, but it's getting very popular in the JS community.

And if you are using PHP5.3, Matthew Weier O'Phinney has just released an implementation of mustache for php5.3

Here is a pretty good introduction to it: http://blog.couch.io/post/622014913/mustache-js

alcuadrado
Thanks I'll have a look at it.
Raphael Jolivet