Converting John Resig's Templating Engine to work with PHP Templates
- by Serhiy
I'm trying to convert the John Resig's new ASP.NET Templating Engine to work with PHP.
Essentially what I would like to achieve is the ability to use certain Kohana Views via a JavaScript templating engine, that way I can use the same views for both a standard PHP request and a jQuery AJAX request.
I'm starting with the basics and would like to be able to convert
http://github.com/nje/jquery-tmpl/blob/master/jquery.tmpl.js
To work with php like so...
<li><a href="{%= link %}">{%= title %}</a> - {%= description %}</li>
<li><a href="<?= $link ?>"><?= $title ?></a> - <?= description ?></li>
The RexEx in it is a bit over my head and it's apparently not as easy as changing the %} to ? in lines 148 to 158. Any help would be highly appreciated. I'm also not sure of how to take care of the $ difference that PHP variables have.
Thanks,
Serhiy