JSON Template
json-template.googlecode.com
json-template.googlecode.com
Here's an architecture of a dynamic web app that works well for me:
- an app server exposes JSON and no HTML. (eg django or rails)
- html/css/js is completely static (eg. on S3/CDN) and defines UI as a set of HTML templates.
- once html/js is loaded in the browser, the browser makes an AJAX call to the server to get the JSON data
- in-browser JS expands a template, the data is rendered out
In this architecture, http://code.google.com/p/google-jstemplate/ is key. Check it out.
When JS processing isn't available on the client side, this same stack is moved to the server side. This way the same logical separation between UI and data is maintained.
and how is incredibly ugly looping and conditional syntax the solution?
> {.repeated section @}, {.or}
It turned out to be just too hard to do anything useful with it.
(BTW, I had no idea Google's templating library was an open-source project. Kinda fun to see that the stuff I work with daily isn't a proprietary walled garden after all. And some trivia for those who don't routinely Google project owners: it's written and maintained by Google's employee #1.)
I, for one, am really looking forward to news.YC's API...
Also, check out JsonML : http://jsonml.org/ . The focus lies more on the client side templating (where it's all JS anyway), but it has additional goodies like XML-to-JsonML XSLT transformation.