Converting John Resig's Templating Engine to work with PHP Templates
Posted
by Serhiy
on Stack Overflow
See other posts from Stack Overflow
or by Serhiy
Published on 2010-03-23T19:53:34Z
Indexed on
2010/03/23
20:03 UTC
Read the original article
Hit count: 588
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
© Stack Overflow or respective owner