title: Dojo and templating solutions
body: <p>Normally I'm in the jQuery world, I develop a wep app using requirejs, backbone.js and jquery.<br>
  In order to broaden my horizon I also started using Dojo.<br>
  Before I started using Dojo, the statements that I was reading in several blogs about it in relation to jQuery were something like: "If you're making a normal website with some JS effects, you can use jQuery, but for the web app stuff you should use Dojo".<br>
  So, because of that, when I started with Dojo (1.7), I was eager to get to know its solutions for web app development.<br>
  The first thing that surprised me was that I did not find any base class for a mvc controller component. In backbone.js you have a view for that (many people say the backbone.js view is a controller), and this helps a lot.<br>
  Now, in my mvc controller component I want to render the view. I "load" the template by using an amd text plugin. For simple templating - I found out - you can use dojo.string.substitute. But I if you want to do something that's a little more complicated, you cannot use it.<br>
  I know that Rebecca Murphey, a well known javascript speaker, pulled Mustache.js into Dojo, when she started developing in this ecosystem.<br>
  But what Dojo native solutions do Dojo web application programmers use when they have to render a list with a dynamic number of lines and they want to achieve this by js templating?</p>
  
  <p>In underscore templating. When you want to do this, you write something like the following in the template:  </p>
  
  <pre><code> &lt;div&gt;&lt;%= lang_test %&gt;&lt;/div&gt; &lt;!-- static things --&gt;  
   &lt;table&gt;
   &lt;% _.each(list, function(listitem){ %&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;%= listitem.get('attr1') %&gt;&lt;/td&gt;
   &lt;td&gt;&lt;%= listitem.get('attr2') %&gt;&lt;/td&gt;
   &lt;/tr&gt;   
   &lt;% }); %&gt;
   &lt;/table&gt;
  </code></pre>
  
  <p>Thanks alot<br>
  Wolfgang</p>
  
  <p>Update:<br>
  Thank you, mkriheli, for your answer. I also stumbled over dojox.dtl!<br>
  I think I will use this.<br>
  You mentioned your preferred way to handle this are templated widgets. That's very interesting thing, WIDGETS AS PAGE CONTROLLERS WITH TEMPLATING! </p>
  
  <p>1) My first javascript web 2.0 MVC page controller was a big custom jQuery UI widget. I heard that the jQuery UI team is planning to integrate templating into their widgets.
  I turned away from it after migrating to jquery with backbone.js.</p>
  
  <p>2) As far as I know and understand, Justin Meyer from JavascriptMVC took the jQuery UI widget factory part (base part of jQuery UI widgets) and uses it in his framework as page controller.</p>
  
  <p>3) Mark Wubben talked at a Dojo Conf about templating: He said:</p>
  
  <blockquote>
    <p>This leads to a new and interesting approach for writing Dojo widgets. They can become much more like controllers: handling DOM events, implementing application logic and updating a model. The view will automatically reflect the changes.</p>
  </blockquote>