[Catalyst] Jemplate and AJAX woes... [Bump -anyone??]

Robert Krimen robertkrimen at gmail.com
Sat Aug 16 22:52:32 BST 2008

On Sat, Aug 16, 2008 at 12:45 PM, Ian Tegebo <ian.tegebo at gmail.com> wrote:

> After a friend had recommend jQuery, I've found I really like it but
> had been under the impression that I wouldn't be able to use Jemplate
> at the same time.

No, Jemplate WILL COEXIST with any other javascript you may be running
client side.
In fact, the latest Jemplate release has the option of using jQuery (or YUI)
to perform
AJAXy stuff (get & post).

> A second read of Rockway's Editable Addressbook in
> chapter 7 of the Catalyst book leaves me wondering how TT, Jemplate,
> and jQuery would best "get along".  Is it the case that
> Catalyst::View::Jemplate exists to reduce HTML munging within
> client-side javascript?

Jemplate in general exists for that purpose. The problem with doing heavy
HTML/UI-lifting browser-side is that you end up doing things like:

   var html =3D '<div class=3D"' + styleClass + '"><a href=3D"' + uri ...

It quickly becomes unwieldy. Jemplate basically creates methods that do the
above (and more).

The other option is to use a javascript templating system (interpolating and
parsing in javascript? probably slow) or
use a widget system that may not have the specific look & feel you're going

> If so, then is it correct to think of jQuery, Jemplate, and the
> Catalyst::Controller::REST interface as kind of a browser-side MVC?

jQuery is a really nice way of manipulating DOM + some convenience
functions: no MC
involved (*maybe* the V part)

Jemplate is just a templating system that plugs into javascript: again, no
MC involved (just the V part)

I suppose you can think of C::C::REST as the data-layer for your model, but
then you're still missing the Controller
aspect and a way of representing the Model in javascript.

> I'm imagining the REST calls through jQuery as accessing the "model"
> while qQuery serves as the controller via its selectors finally
> rendering its "view" through Jemplate.

Sounds about right, but it's more like making API calls to your C::C::REST

> BTW, it appears Catalyst::View::Jemplate  broke after Jemplate >=3D 0.21
> changed the behaviour of Jemplate::runtime_source_code (see RT 35609,
> 37813).  What versions are you running?

I'll try and take a look to at Jemplate and see what's going on. What you
*can* do
is just do a Jemplate compile via a Makefile or something and then serve the
.js as you would any other javascript asset.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080816/76e5e=

More information about the Catalyst mailing list