I’m looking for a simple Template engine that works both on client side with JS ánd on server side with PHP.
That means I want to be able to use the same template definition for both use cases.
Do you know any templating engines that have official implementations in both JS and PHP?
If you like JS->PHP priority 🙂 then you have this two jquery-tmpl compatible template renderer for PHP backend
If you prefer more PHP->JS priority 🙂 then you can try this Javascript implementation of popular PHP templating Smarty
Or you can try something more neutral like:
- Mustache http://mustache.github.com/
Answer:
Do you mean something like mustache?
Answer:
You have a new option to compile templates for both PHP and JS using Twig + Twig.js
Answer:
Use Mustache!
AFAIK, Mustache is the only template engine that has official implementations in both PHP and JS… along with two dozen programming/scripting languages.
-
Twig does have a JS version, but that’s incomplete and AFAIK unofficial.
-
Smarty does have a JS version, but it’s also an unofficial port… and Smarty is getting a bit outdated.
Tags: java, javascriptjavascript, php