We use Template Toolkit where I work, and I am looking for similar functionality, but minus the perl, using only HTML5, PHP, and jQuery.
The app I am creating is an offline HTML5 app, so basically I want to do:
if (localStorage.getItem(username) != '') {$.("#myDiv").html(myBlock);}else {$.("#myDiv").html(myOtherBlock)};
So far the ways I’ve thought of either involve creating long html string variables in jQuery, or putting the blocks in the html, and then using jQuery to create a variable of that dom element, and then remove it from the document, neither of which seem very optimal to me.
Can anybody point me in the right direction please?
Jemplate might be a possibility if you’re looking for a JavaScript implementation of Template Toolkit. I suspect its usage is more experimental than popular, though.
Handlebars seems to have a much more active community and adoption rate.