From the link: Degrades gracefully if JavaScript is not enabled
Graceful degradation is less common for JavaScript now than it used to be though. So if you want a smooth web experience, these days you just can't go without JavaScript. I personally don't think that's a horrible thing, but I guess most people who've disabled JavaScript (or use Lynx or something) would disagree.
I generally pass the templates needed for a page into a Javascript variable from the back end. Looks nice for template nesting though, as opposed to storing a nested template in a separate Javascript variable.
sorry to be a hater, but while I find the idea of mixing js and html not great, the alternative being offered up here is to introduce a new language and mix that in with html instead of js. isn't that counterintuitive? wouldn't it be better to just use actual js in your templates instead of this arbitrary {{}}-based stuff?
Looks interesting, especially to those coming from Smarty as it appears quite similar in terms of templating.
To compare the two, the upside is you get to feed the site JSON, which is easier to generate. The downside is the extra content load time of the script vs doing the template integration server side and caching the result.
You can use tags in your django templates do avoid that issue. For instance, I am using icanhaz which use mustache's templates ({{}}) and I inspired myself of a snippet called Verbatim. So, basically, in your template you do:
<body>
{% js_template test %}
Here you can freely use {{}} because the surrounding tags make django ignore them.
{% endjs_template %}
[+] [-] y0ghur7_xxx|15 years ago|reply
You could add yours.
[1]http://jsperf.com/dom-vs-innerhtml-based-templating/112
[+] [-] franze|15 years ago|reply
[+] [-] ehsanul|15 years ago|reply
Graceful degradation is less common for JavaScript now than it used to be though. So if you want a smooth web experience, these days you just can't go without JavaScript. I personally don't think that's a horrible thing, but I guess most people who've disabled JavaScript (or use Lynx or something) would disagree.
[+] [-] tomjen3|15 years ago|reply
[+] [-] thefreshteapot|15 years ago|reply
Thomas Fuchs has a very similar version: http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-...
And finally, I ported the template functionality from the "prototype.js" to php. https://github.com/freshteapot/php-template
Prototypejs - api of "Template" http://api.prototypejs.org/language/Template/
[+] [-] robryan|15 years ago|reply
[+] [-] Ataraxy|15 years ago|reply
For example, I could conceivably see taking an existing web services API and spitting JSON results into a themeforest template.
I'm sure there's a million ways of doing it, but this at a glance seems like a quick way of making that happen.
[+] [-] etherealG|15 years ago|reply
[+] [-] biot|15 years ago|reply
[+] [-] zdw|15 years ago|reply
To compare the two, the upside is you get to feed the site JSON, which is easier to generate. The downside is the extra content load time of the script vs doing the template integration server side and caching the result.
[+] [-] d0m|15 years ago|reply
[+] [-] aitorciki|15 years ago|reply
[+] [-] d0m|15 years ago|reply
[+] [-] keytoll|15 years ago|reply