I just wrote this whole post just to re-read your question and see “not Smarty”: P. I will just say that I looked at the JS and PHP template library for a while, and Smarty seemed to be the best option for me. You say that Mustache is not enough. The only thing that comes to mind with the functionality of JS and PHP is Haml .
Original:
I have no experience with this, but I started using Smarty PHP templates. I create one Smarty template and send JSON to the client for Ajax requests. Then I use this JS Smarty engine for client-side processing. If the client does not support Javascript, I can gracefully degrade by simply sending the PHP-related array to the Smarty server server, instead of sending it to the JSON parser. Still using the same .smarty file, which works pretty well, and I think I will continue to use this methodology for the rest of my project.
source share