title: PHP/TWIG : for loop to build HTML divs
body: <p>I come from ASP.NET MVC and the following was easy enough to do. I'm wondering how it can be done with PHP and TWIG.</p>
  
  <p>I want to dynamically build a series of HTML div. A div looks like this:</p>
  
  <pre><code>&lt;div class="grid_gallery-item"&gt;               
      &lt;img src="img/gallery/gallery_grid1.jpg" alt=""/&gt;                       
      &lt;a href="img/gallery/gallery_grid1.jpg"&gt;&lt;/a&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>Ths src attribute of the image as well as the href of the hyperlink should be different for every divs. I would like to do it in a for loop, using the incrementer to change src and href paths.</p>
  
  <p>One more difficulty is that I use assetic (symfony2) for my paths. So the src attribute and href attribute are actually like:</p>
  
  <pre><code>{{asset('img/gallery/gallery_grid1.jpg')}}
  </code></pre>
  
  <p>How can I do that ? </p>