0

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?

StephenRios
  • 2,192
  • 4
  • 26
  • 42

1 Answers1

1

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.

Stennie
  • 63,885
  • 14
  • 149
  • 175
  • I realize this is an old thread, but Jemplate (http://www.jemplate.net) is still going strong 3 years later (as is Handlebars of course), so beware of decisions by popularity contest. – nebulous Jul 07 '15 at 13:30