tag:blogger.com,1999:blog-10678074.post4116195574575028555..comments2024-03-29T05:02:48.371+00:00Comments on making apps, making webs.: You are using the wrong #templating system for #html.Unknownnoreply@blogger.comBlogger19125tag:blogger.com,1999:blog-10678074.post-43915840445221284702010-06-01T17:02:30.326+01:002010-06-01T17:02:30.326+01:00Doesn't pure do this already?Doesn't <a href="http://beebole.com/pure/" rel="nofollow">pure</a> do this already?Bruce Durlinghttps://www.blogger.com/profile/01495431997076082334noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-77706604650722174062010-06-01T16:22:58.386+01:002010-06-01T16:22:58.386+01:00This comment has been removed by the author.Bruce Durlinghttps://www.blogger.com/profile/01495431997076082334noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-12002878060890351042010-05-17T10:18:40.349+01:002010-05-17T10:18:40.349+01:00Oooh, I thought about this at Pycon in Chicago las...Oooh, I thought about this at Pycon in Chicago last year...<br /><br />I was thinking that you could run a headless webkit on the server to static-ify AJAX applications for non-JS clients (spiders in particular).Petehttps://www.blogger.com/profile/13365466214773392763noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-40642323000738941372010-05-15T23:22:55.932+01:002010-05-15T23:22:55.932+01:00Deliverence or XDV is definitely the future. I'...Deliverence or XDV is definitely the future. I've said it before, and I'm saying it again: It's a game changer.<br /><br />But you still need to generate the HTML that XDV eats, and that is still best done with a templating system of some sort. Personally, I like "templess", but never have a chance to use it, so I'm stuck with ZPT.Lennart Regebrohttps://www.blogger.com/profile/08337807480455483637noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-6126988379221486112010-05-15T19:26:49.948+01:002010-05-15T19:26:49.948+01:00I blogged about this a month or so ago; instead, I...I blogged about this a month or so ago; instead, I decided to use PyQuery on the server side and it achieves roughly the same results.Pete Hunthttps://www.blogger.com/profile/06092162473317532443noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-54484613985512784462010-05-15T12:31:21.740+01:002010-05-15T12:31:21.740+01:00@David Keeney: You can cache the template and the ...@David Keeney: You can cache the template and the data, but with a server-side solution you can cache a "baked" page with the data in the HTML page already.<br />Example can be a Slashdot page. If the client has to pick up a template HTML and then fill in the hundreds of comments from JSON files that will take a non-trivial amount of time. Slashdot bakes a static page <i>once</i> and then serves it to multiple clients.<br /><br />Besides, if you keep the same HTML file and have AJAX requests to update the data when the user clicks something, you'll have to do all those "URL tricks" to ensure the user gets to the right page if he e.g. bookmarks it or send the URL to a friend.<br /><br />Client-side templating is OK for RIAs, where it's already used. But not for most web sites.<br /><br />Now, server-side is a different matter. Yes, it's interesting, and you'd end up with a machine-parsable view for free.icebrainhttps://www.blogger.com/profile/02801239031869649026noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-46877668810657741302010-05-14T22:34:30.319+01:002010-05-14T22:34:30.319+01:00hi,
Sorry for the poor confusing writing in the b...hi,<br /><br />Sorry for the poor confusing writing in the blog post.<br /><br />One way of implementing this would be to import 'server side' js first before client side js.<br /><br />Then it's just a normal dynamic HTML page. Get your json object/s from a URL, or just included in the page as javascript, and modify the page.<br /><br />At this point, you can save the html and send it out to the client. Or you can start running the other client side JS.<br /><br />It can act either as completely client side templating, or completely server side templating.<br /><br />You could do includes by reading other html, and then finding the parts you want in there, and inserting it. Using an include class of some sort would work well I think as you suggest.<br /><br />However, different front end developers would use different tool kits. eg, one may use jquery, another GWT, another YUI.<br /><br />I haven't used this technique for a whole project, but it has worked well for parts of it. The server side programmers just produce the json, and the front end ones just produce the html+js. Neither of them have to even see the other persons work - except for the sample json. <br /><br />No need to translate the html into a template, and no need to have the server side code even finished! Just save a .json file, and the front end programmer can work. They don't need to set up apache, download 32 libraries, run a server on a different OS, get a database set up... and file bugs with the server people, and the admin people. All those problems are removed.<br /><br />No need to train up the front end programmer in the platform, or the templating language of choice either. Also the back end coders do not have to edit something they don't know that much about (html/css/js), so the quality remains higher.<br /><br />cu.René Dudfieldhttps://www.blogger.com/profile/17762358075557755436noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-65203413754200728092010-05-14T19:14:18.295+01:002010-05-14T19:14:18.295+01:00icebrain: client-side templates are pages and scr...icebrain: client-side templates are pages and scripts; they are cached, and cached offsite by the client and various intermediate network nodes. So a typical page might be just one request, since the embedding page and scripts are cached offsite, and that one request is bandwidth-frugal JSON. <br /><br />lawrence: the criticism about AJAX pages being invisible to search engines is valid, but it may not be true forever. Google has its own javascript engine; what is keeping them from having their spiders do jscript rendering?David Keeneyhttps://www.blogger.com/profile/05853065350985701131noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-29761695067827835182010-05-14T18:25:08.906+01:002010-05-14T18:25:08.906+01:00Interesting idea. I'm assuming the templating ...Interesting idea. I'm assuming the templating would be done on the server side.<br /><br />Although I love ZPT (especially because of James Clark's nxml-mode for emacs), traditional templating does create a middle-man between the html coders and the backend. Personally I know zero-design, a bit of html/css/js and alot about templating and backend. Most of my time is spent templating but really I'd rather spend most of the time on the backend :)<br /><br />The problem I see with the json/dom approach though is similar to issues I've come across with push templating libraries in general. It tends to separate the data from the templating structure so much it feels very disconnected and fragile. <br /><br />I'm with elarson, seems like some kind of framework would need to be built to eliminate the tediousness of raw dom manipulation. Would that eliminate the middle-man template master or just create a new breed?Mcweeklyhttps://www.blogger.com/profile/07770753706036556338noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-81686243643487713382010-05-14T17:49:32.637+01:002010-05-14T17:49:32.637+01:00Why not just use GWT or SproutCore for your fronte...Why not just use GWT or SproutCore for your frontend? Why have a "template" at all?<br /><br />I too would like to see some examples (even if they're non-working pseudocode) of what your idea is. <br /><br />I also would think that caching and searchability are key issues, but people developing GWT applications don't seem to worry much about this, so maybe it's a non-issue?Steve Lacyhttps://www.blogger.com/profile/11403868334966514295noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-89638877799233030702010-05-14T17:33:32.927+01:002010-05-14T17:33:32.927+01:00Well it looks like I might be alone here among the...Well it looks like I might be alone here among the commentators, but I think this is kind of an interesting idea. Just to clarify, it sounds like you are suggesting doing templating on the server side by implementing a callback to fill in values or create HTML via Javascript and JSON. Essentially your template system would look like basic ajax calls expecting JSON that you then insert into the DOM. <br /><br />I could see this working and there is obviously some value in it. The disconnect between templates, snippets and ajax handlers disappears into a unified interface, which is a pretty powerful idea. No longer would you have to consider hints in the request as to what to process and return (html, json, html snippet).<br /><br />The downside in my mind is that at some point you would have to come up with some tools to make the whole process simpler. jQuery would be a nice start but that would require the Javascript processor on your server have the necessary DOM aspects. <br /><br />I'd be curious as well what sorts of additions or framework would be needed. For example, most template systems have a means of including or inheriting other templates. This makes it much easier to make your templates modular. It seems like there would be instances where you'd want similar syntax. Of course, that might simply be an anchor tag with a specific "includes" class. <br /><br />In any case, it is an interesting idea. I'd like to see if anyone has tried it outside of the server side javascript realm.elarsonhttps://www.blogger.com/profile/10311421080197766290noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-24931670832408547172010-05-14T16:27:57.264+01:002010-05-14T16:27:57.264+01:00Quite apart from losing non-javascript users (a sm...Quite apart from losing non-javascript users (a small percentage) and being rather slow to render, your site becomes impossible for search engines to index.<br /><br />Templating systems do suck though, thats why I've been working on <a href="http://pypi.python.org/pypi/xdv" rel="nofollow">XDV</a> which lets you define a simple rules file for merging your content into a plain html theme.<br /><br />@bkc,<br />Can you point me at the ZPT -> XSLT conversion, sounds really interesting.Laurence Rowehttps://www.blogger.com/profile/02164563755538372331noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-38817755823122870152010-05-14T15:43:49.655+01:002010-05-14T15:43:49.655+01:00Wohoo,
I like ZPT so much that I use an XSLT vers...Wohoo,<br /><br />I like ZPT so much that I use an XSLT version of it (lxml converts ZPT to XSLT that can be used server-side or client-side).<br /><br />I also wrote a javascript version of ZPT as well. Both are great.<br /><br />Not sure what this post is about though without some examples.. <br /><br />Cheers,brad clementshttps://www.blogger.com/profile/12500394420477464688noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-35448130212964142972010-05-14T14:55:20.534+01:002010-05-14T14:55:20.534+01:00You'd best come up with some examples in order...You'd best come up with some examples in order to demonstrate that you aren't being so stupid as to suggest building a website that only works with javascript enabled. <br /><br />I'm presuming you have some cunning plan to run javascript on the server to generate html resources - please share!Tim Parkinhttps://www.blogger.com/profile/12597110929479917422noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-27442543938120516182010-05-14T14:31:37.763+01:002010-05-14T14:31:37.763+01:00I really don't get this.
If you are wanting t...I really don't get this.<br /><br />If you are wanting to use a templating system that doesn't introduce extra tags just use ZPT e.g.:<br /><br />http://www.slideshare.net/hammertoe/an-introduction-to-zope-page-templates-and-their-use-outside-of-zope<br /><br />http://www.netsight.co.uk/blog/2010/2/4/zope-page-templates-in-google-app-engine<br /><br />-MattMatt Hamiltonhttps://www.blogger.com/profile/10016352698519956990noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-64668544072137530832010-05-14T13:57:58.955+01:002010-05-14T13:57:58.955+01:00Care to show us how to actually do this in practic...Care to show us how to actually do this in practice?Pekka Kujansuuhttps://www.blogger.com/profile/09942741243680653182noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-70411699893467727322010-05-14T13:25:14.868+01:002010-05-14T13:25:14.868+01:00I'm sorry, this blogpost makes no sense. Are y...I'm sorry, this blogpost makes no sense. Are you saying that instead of a templating system , you should write a Javascript that constructs the page from scratch?Lennart Regebrohttps://www.blogger.com/profile/08337807480455483637noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-19717154284039621072010-05-14T13:23:50.953+01:002010-05-14T13:23:50.953+01:00hmmm caching hmmm performance hmmmmhmmm caching hmmm performance hmmmmJared Forsythhttps://www.blogger.com/profile/15235563645979524582noreply@blogger.comtag:blogger.com,1999:blog-10678074.post-61463007317783752632010-05-14T13:03:25.932+01:002010-05-14T13:03:25.932+01:00Javascript dependency for static content is bad. W...Javascript dependency for static content is bad. What happened to graceful degradation?<br /><br />Besides, that would require yet another HTTP request to the server. More latency, more user CPU usage.<br /><br />Thirdly, server-side processing templates can be cached. Client-side templates can't.icebrainhttps://www.blogger.com/profile/02801239031869649026noreply@blogger.com