Answers.Body: <p>There's no easy twig function available to do this, but the code from <a href="https://stackoverflow.com/questions/17715777/how-to-make-3-columns-table-with-twig-in-symfony2">this answer</a> should be able to help you.</p>
  
  <pre><code>{% set columns = 3 %}
  {% for entry in entries %}
      {% if loop.first or loop.index0 is divisibleby(columns) %}
          &lt;tr&gt;
      {% endif %}
  
      &lt;td&gt;{{ entry.title }}&lt;/td&gt;
  
      {% if loop.last and loop.index is not divisibleby(columns) %}
          {% for n in range(low=columns - (loop.index % columns), high=1, step=-1) %}
              &lt;td&gt;&amp;nbsp;&lt;/td&gt;
          {% endfor %}
      {% endif %}
  
      {% if loop.last or loop.index is divisibleby(columns) %}
          &lt;/tr&gt;
      {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-10T20:09:21.853Z
Answers.Text: That's a good start, but how can that work with different columns as `<div>`s?
Answers.UserDisplayName: Malte
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-10T18:35:28.280Z
Answers.LastActivityDate: 2017-09-10T18:35:28.280Z
Answers.UserDisplayName: Rias
Answers.Body: <p>You'll need to loop through all entries first and divide the entries into three arrays. Then using a combination of <code>id</code> and <code>fixedOrder</code> you can create three more entries calls to loop through each column and it's entries.</p>
  
  <p>This would make a nice dynamic solution that doesn't need refactoring as more entries are added.</p>
  
  <p><a href="https://craftcms.com/docs/templating/craft.entries#fixedOrder" rel="nofollow noreferrer">https://craftcms.com/docs/templating/craft.entries#fixedOrder</a>
  <a href="https://craftcms.com/docs/templating/craft.entries#id" rel="nofollow noreferrer">https://craftcms.com/docs/templating/craft.entries#id</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-11T19:30:08.513Z
Answers.Text: Sounds great! Can you give me a boost with a small example of the syntax? I don't know how exactly to accomplish this with twig.
Answers.UserDisplayName: Malte
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-11T19:15:47.290Z
Answers.LastActivityDate: 2017-09-11T19:15:47.290Z
Answers.UserDisplayName: Chris Southam
Body: <p>I'm trying to build a feed of entries in a column grid. Something like that:</p>
  
  <pre><code>&lt;div class="column"&gt;
   &lt;a class="entry"&gt;First entry&lt;/a&gt;
   &lt;a class="entry"&gt;Fourth entry&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class="column"&gt;
   &lt;a class="entry"&gt;Second entry&lt;/a&gt;
   &lt;a class="entry"&gt;Fifth entry&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class="column"&gt;
   &lt;a class="entry"&gt;Third entry&lt;/a&gt;
   &lt;a class="entry"&gt;Sixth entry&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I achieve that? In my head <code>.batch(3)</code> only works horizontally for rows.</p>
  
  <p><em>Edit:</em> To make it more clearly, that's my goal and the reason for columns instead of rows:</p>
  
  <p><a href="https://i.sstatic.net/wmLq3.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wmLq3.jpg" alt="Column Grid"></a></p>
  
Tags: <entries><layout>
Title: Split entries in columns
ThreadText: # Split entries in columns
  
  (Asked by: username_0 on 2017-09-09)
  
  I'm trying to build a feed of entries in a column grid. Something like that:
  
  ```
  <div class="column">
   <a class="entry">First entry</a>
   <a class="entry">Fourth entry</a>
  </div>
  
  <div class="column">
   <a class="entry">Second entry</a>
   <a class="entry">Fifth entry</a>
  </div>
  
  <div class="column">
   <a class="entry">Third entry</a>
   <a class="entry">Sixth entry</a>
  </div>
  
  ```
  
  How do I achieve that? In my head `.batch(3)` only works horizontally for rows.
  
  *Edit:* To make it more clearly, that's my goal and the reason for columns instead of rows:
  
  [![Column Grid](https://i.sstatic.net/wmLq3.jpg)](https://i.sstatic.net/wmLq3.jpg)
  
  **Tags:** entries, layout
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-09-10. Score: 1
  
  There's no easy twig function available to do this, but the code from [this answer](https://stackoverflow.com/questions/17715777/how-to-make-3-columns-table-with-twig-in-symfony2) should be able to help you.
  
  ```
  {% set columns = 3 %}
  {% for entry in entries %}
      {% if loop.first or loop.index0 is divisibleby(columns) %}
          <tr>
      {% endif %}
  
      <td>{{ entry.title }}</td>
  
      {% if loop.last and loop.index is not divisibleby(columns) %}
          {% for n in range(low=columns - (loop.index % columns), high=1, step=-1) %}
              <td>&nbsp;</td>
          {% endfor %}
      {% endif %}
  
      {% if loop.last or loop.index is divisibleby(columns) %}
          </tr>
      {% endif %}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: That's a good start, but how can that work with different columns as `<div>`s?  
  
  ---
  
  ### Answer by username_2 on 2017-09-11. Score: 1
  
  You'll need to loop through all entries first and divide the entries into three arrays. Then using a combination of `id` and `fixedOrder` you can create three more entries calls to loop through each column and it's entries.
  
  This would make a nice dynamic solution that doesn't need refactoring as more entries are added.
  
  <https://craftcms.com/docs/templating/craft.entries#fixedOrder>
  <https://craftcms.com/docs/templating/craft.entries#id>
  
  > **Comments:**
  > **username_0**: Sounds great! Can you give me a boost with a small example of the syntax? I don't know how exactly to accomplish this with twig.  
  
  ---
  
  