Nik,

Has anyone ever considered implementing a Javascript engine for the TT syntax? I rather fancy the idea of offloading the template processing from my web server to the web browser.

Well, I see you got 4 practically simultaneous responses all pointint out Jemplate. So, just to be different, I'll tell you our approach here.

We use OpenThought ( http://www.openthought.net/ ) for our AJAX type stuff. It's been around several years (it was AJAX long before AJAX was called AJAX), it's easy to work with, and Eric Andreychek (the developer) has always been very responsive to bug reports and feature requests. The main advantage I see is that it's completely decoupled from the templating system--in fact, when I first starting using OT here at ThinkGeek, it came with a default tie-in to CGI::Application and HTML::Template, but it was pretty easy to drop in TT2 instead, and now with OT2 Eric has made OT a lean, mean AJAX machine. So I have one class that I built which does all the templating stuff (via TT2) and all the AJAX stuff (via OT), and that's my interface. If I decide one day I don't like TT2 any more (unlikely) or maybe that I want to upgrade to TT3 (quite likely), I have one place to change my code, and my AJAX stuff isn't impacted at all. And likewise if I want to change my AJAX implementation. Plus I don't have to know very much JS (admittedly, I had to learn more than I really wanted to once TPTB starting seeing what could be done and the feature creep set in, but in general most of the JS is inside OT, and I'm free to do the vast majority of my coding in Perl, which is where I like it). Plus all the JS calls into OT were nicely encapsulated into TT2 macros. We're very pleased with the way it all works.

Just another thought.


                -- Buddy

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to