Answers.Body: <p>I would go with Twigs <a href="http://twig.sensiolabs.org/doc/filters/batch.html" rel="nofollow"><code>batch</code></a> filter, which exactly solves your problem.</p>
  
  <p>Here an an adapted example:</p>
  
  <pre><code>{% set items = craft.entries({
      section: 'events',
      level: 2
  }).find() %}
  
  {% for row in items|batch(2, 'No item') %}
      &lt;div class="row"&gt;
          {% for item in row %}
              {# Your entry #}
          {% endfor %}
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-30T14:21:55.707Z
Answers.Text: Thx! Almost there.. Alas this outputs the content of my structure level1 n times. Can't figure out what i'm doing wrong.
Answers.UserDisplayName: eek-a-edge
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-30T14:37:16.640Z
Answers.Text: I changed my example slightly to get the entries you ask for. Not tested, but I think this should work. You could also solve it with chaining `{% set items = craft.entries.section('events').level(2).find() %}`.
Answers.UserDisplayName: Pascal Mollet
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-30T15:03:54.603Z
Answers.Text: No matter how i try to chain it, it keeps giving me the content of the parent. The number of the items is right but not the content. When i wrote `{% for entry in craft.entries.find({section:'events' ,level: 2 }) %}` the output was fine but then i couldn't do an output in batch.
Answers.UserDisplayName: eek-a-edge
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-30T15:22:31.573Z
Answers.Text: My bad > i never changed my output code to the new function name. Stupid beginners mistake. thank You much for your help!
Answers.UserDisplayName: eek-a-edge
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-30T14:03:27.353Z
Answers.LastActivityDate: 2014-09-30T14:34:02.370Z
Answers.LastEditDate: 2014-09-30T14:34:02.370Z
Answers.UserDisplayName: Pascal Mollet
Body: <p>how can i output my content in pairs?</p>
  
  <p>like this:</p>
  
  <pre><code>div.row &gt;   entry 1 + entry 2
  div.row &gt;   entry 3 + entry 4
  div.row &gt;   entry 5 + entry 6
  </code></pre>
  
  <p>so far i have the following</p>
  
  <pre><code>{% for entry in craft.entries.find({section:'events' ,level: 2 }) %}
  &lt;div class="row"&gt;
  
      {% if loop.index0 is divisible by(2) %}
      (entry odd output here)
      {% endif %}
  
      {% if loop.index is divisible by(2) %}
      (entry even output here)
      {% endif %}
  
  &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>but this just gives me a new row for each entry.
  What's the best approach?</p>
  
Tags: <forloop>
Title: How can i output my content in pairs?
ThreadText: # How can i output my content in pairs?
  
  (Asked by: username_0 on 2014-09-30)
  
  how can i output my content in pairs?
  
  like this:
  
  ```
  div.row >   entry 1 + entry 2
  div.row >   entry 3 + entry 4
  div.row >   entry 5 + entry 6
  
  ```
  
  so far i have the following
  
  ```
  {% for entry in craft.entries.find({section:'events' ,level: 2 }) %}
  <div class="row">
  
      {% if loop.index0 is divisible by(2) %}
      (entry odd output here)
      {% endif %}
  
      {% if loop.index is divisible by(2) %}
      (entry even output here)
      {% endif %}
  
  </div>
  {% endfor %}
  
  ```
  
  but this just gives me a new row for each entry.
  What's the best approach?
  
  **Tags:** forloop
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-09-30. Score: 3 | Accepted answer
  
  I would go with Twigs [`batch`](http://twig.sensiolabs.org/doc/filters/batch.html) filter, which exactly solves your problem.
  
  Here an an adapted example:
  
  ```
  {% set items = craft.entries({
      section: 'events',
      level: 2
  }).find() %}
  
  {% for row in items|batch(2, 'No item') %}
      <div class="row">
          {% for item in row %}
              {# Your entry #}
          {% endfor %}
      </div>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thx! Almost there.. Alas this outputs the content of my structure level1 n times. Can't figure out what i'm doing wrong.  
  > **username_1**: I changed my example slightly to get the entries you ask for. Not tested, but I think this should work. You could also solve it with chaining `{% set items = craft.entries.section('events').level(2).find() %}`.  
  > **username_0**: No matter how i try to chain it, it keeps giving me the content of the parent. The number of the items is right but not the content. When i wrote `{% for entry in craft.entries.find({section:'events' ,level: 2 }) %}` the output was fine but then i couldn't do an output in batch.  
  > **username_0**: My bad > i never changed my output code to the new function name. Stupid beginners mistake. thank You much for your help!  
  
  ---
  
  