Thursday, February 14, 2008

Django Template Language - the dojo implementation

Beside of Erlang based ErlyDTL (by Evan Miller and myself) there exists (at least) one other non-Python project which implements the Django Template Language: the dojo Javascript version: dojox DTL (documentation) for creating dynamically and template-based HTML layouts inside the Web browser (opposed to traditional approaches of creating HTML layouts at server-side). Today dojox DTL reached feature completeness, implementing all original Django tags and filters, at least that is what I guess from reading the SVN changes for the README:
--- This aims to be a 1:1 match with the Django Template Language as outlined in
+++ This is a 1:1 match with the Django Template Language as outlined in
While dojox DTL is a very interesting concept and brings new possibilities to separate client-side logic and presentation, I haven't seen yet a killer example. Maybe I just haven't looked far enough. But one thing is sure: if you use a template language at server side and at Javascript client side, and it can be the same template language, that's a huge benefit.

3 comments:

Anonymous said...

Hey Roberto:

So "killer example" is probably using dojox.dtl inside of widgets to do iteration over dojo.data results or via the sexy dojo.query() extension which provides simple templating from JSON objects. Neil's really been on a roll, and if your server can generate JSON, it can be hooked up to a very dynamic view.

If nothing else, DTL completely changes the game for authoring Dojo widgets, and that's a good thing.

Regards

Roberto Saccon said...

Alex, thanks for enlighten me about possible "Killer examples".

Unknown said...

I'm searching the whole web now for days in order to find such a killer example. I need to build complex widgets based on dojox.dtl where the templates constist of widgets that have widgets nested, that have widgets nested, and so on...
But I can't get it to work. The first level widgets are rendered correctly, but the widgets that are inside of them aren't. So i really would love to see a more sophisticated use-example of DTL. If you ever find one, let me know at tas.tdbengine.org

I think the problem with dojo often is, that the examples provided are too small - too far away from a real-application usecase. It's always about "countries" and "fruits+vegetables" - if you know what I mean.