Hello everybody, I'm Misha, a second year computer science student at Tbilisi State University.
I have several ideas for GSOC, all of them are related to templates. I'm generally interested in templates.
The first idea is to create php/Smary helpers for Dojo. We have many reasons to do it:
to assist php developers who don't know js and dojo;
To avoid duplications(especially useful for form validation);
to make integration with database and other server-side resources easier;
To make it possible to create gracefully degrading applications for javascript-disabled users. This will work like this: if the client does not have javascript enabled, it will be redirected to "samepage.php?jsenabled=no"; then our template will generate simple html instead of dojo code. We will have to implement simple server-side plain-html renderers for common dijit widgets.
The other idea is to implement smarty with js. I mean just a subset of it. This will help us to create gracefully degrading apps as well - we will be able to use the same smarty template on server-side or client-side, depending on whether client has js enabled or not;
I had one more idea - about extending dojox.dtl - I wanted to make it rerender only parts of DOM that need to change when data changes. I was so disappointed to find out that dtl already does that :D But it can do it more efficiently - As I understand, it rerenders everything and then merges it to existing DOM tree; I think It will much faster if it only processed the parts of template which deal with changed input data; Implementing an event-delegation based event-attaching mechanism(similar to liveQuery jQuery extension) would also make some things easier and faster when creating complex dynamic components.

Comments
Hey Misha,
Cool. Are there already JS helpers for Smarty for any JS toolkits? Is something like the rails/prototype helpers a good place to start? Or do you think people developing with Smarty would prefer something different?
Dijit widgets declared in markup already fall back to plain HTML if there is no Javascript available... try it :)
So this would be something like dojox.smarty that would work similarly to dojox.dtl? Could we use the code that Neil has created in dojox.dtl with a different parser?
- Rob :)
Are there already JS
I've never heard of such thing for Smarty, although there are php helpers for many JS toolkits. Yes, the API will be similar to RoR Prototype helpers. It will make more sense for Dojo, as Dojo has many UI widgets, unlike Prototype.
Simple ones do, but more complex widgets like Grid and Tree, don't. Grids and trees can be easily fed from database tables if we use php-wrappers.
We can also easily create non-js versions for layout containers.
International applications will be able to work without JS - php will read the same localization files and render strings.
In some cases, when we are developing complex RIA-s, this kind of helpers won't be useful at all, but there many cases where web-developers just want to enhance user-experience and it will be nice if such "light RIA"-s could work without js.
This will also be good for SEO.
But I'm not sure about this - will Dojo hire somebody to write mainly php code?
Yes, it will be based on dtl and will use most of its code. It won't be hard to create Smarty version of the parser - the syntax is not very different. But we will need to implement standard Smarty tags and filters (there are a lot or them - http://www.smarty.net/manual/en/). I'm also thinking about creating a base template class which will be easier to extend to support other template syntaxes.
But does dojo need another template engine at this point, when it already has a nice Django template language and it's still in beta?
-misha
server side
Hi Misha. Server-side rendering of widget templates is a topic that resurfaces every six months or so (i.e., everybody talks about it and says it's a great idea but no one has actually implemented it, although Neil Roberts did build a cool prototype using Jaxer)...
I don't know offhand what (if anything) smarty would give us that we don't get from DTL.
However, you are suggesting something I haven't heard before though, about supporting browsers with JS disabled... for complex widgets. The idea of converting a data store and a <div dojoType="dojox.Grid"> into just a plain <table> with all the data inlined... it's interesting. It seems like that might go beyond just template replacement. Sounds like a big project.
for php developers
Smarty in browser will be useful for developers who use php and Smarty at server-side. This will let them easily create rich front-ends for existing applications which use Smarty. They will be able to to use the same templates at client side-and server-side, which will help them create apps that work event without javascript and are more search engine friendly.
BTW, Rob told me that dojox.grid can also be populated from <table> element.
table/grid
After looking deeper, I can't find what I was talking about. :)
dojox.data.HtmlTableStore should be able to be used by a grid, but it'd be quite cool to make it so the grid could build off the table-store directly.
Or a super-base for the grid where it could parse out inner grids...
<thead> ... </thead>
<tbody>
<tr>
<th><table> ... inner grid for this row that can be expanded... </table></th>
<td></td>
</tr>
</tbody>
</table>
- Rob :)