<p><code>offset</code> works for matrix blocks the same way it does for <a href="http://buildwithcraft.com/docs/templating/craft.entries#offset" rel="nofollow">entries</a>.</p>

<p>So you can do this to skip the first 12</p>

<pre><code>{# skip the first 12 blocks #}
{% for contentBlock in matrixField.offset(12) %}
  ...
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-02-10T17:31:05.900Z
2015-02-10T17:31:05.900Z
Marion Newlevant
<p>I managed to solve this by using this...</p>

<p><code>{% for contentBlock in matrixField.id('&gt;=237') %}</code></p>

<p>In reality 237 is defined in a segment.</p>

<p>But it occurred to me that the ID of the block isn't necessarily the order of the block within the Matrix - for example if I add a new block and that's given an ID of 200, and I drag it up - it still remains as 200.</p>

<p><code>ID != Position</code></p>

<p>So to resolve this I took advantage of <code>loop.index0</code> to identify the true order of the row. I then wrap the switch statement within a conditional...</p>

<p><code>{% if loop.index0&gt;=craft.request.getSegment(3) %}</code></p>

<p>Now I can output only the rows after the page break.</p>

CC BY-SA 3.0
2015-02-10T10:32:29.603Z
2015-02-10T10:48:44.463Z
2015-02-10T10:48:44.463Z
Mutual
<p>Is it possible to start a matrix loop from a particular block ID?</p>

<p>I am trying to set a new block called "New Page" so that an author can split an article into multiple pages.</p>

<p>Currently it's able to detect a page break and exit out of the block field loop. I have also identified the next block's ID.</p>

<p><code>{% set nextBlockAfterPageBreak = contentBlock.getNext().id %}</code></p>

<p>Now what I'd like to be able to do is to get all blocks from <code>nextBlockAfterPageBreak</code>.</p>

<p>So for example,</p>

<p><code>{% for contentBlock in matrixField where firstBlock = 237 %}</code></p>

<p>Does anybody know if this is possible?</p>

<matrix>
Start matrix loop from block ID
# Start matrix loop from block ID

(Asked by: username_0 on 2015-02-10)

Is it possible to start a matrix loop from a particular block ID?

I am trying to set a new block called "New Page" so that an author can split an article into multiple pages.

Currently it's able to detect a page break and exit out of the block field loop. I have also identified the next block's ID.

`{% set nextBlockAfterPageBreak = contentBlock.getNext().id %}`

Now what I'd like to be able to do is to get all blocks from `nextBlockAfterPageBreak`.

So for example,

`{% for contentBlock in matrixField where firstBlock = 237 %}`

Does anybody know if this is possible?

**Tags:** matrix


---

## 2 answers

### Answer by username_1 on 2015-02-10. Score: 4 | Accepted answer

offset works for matrix blocks the same way it does for entries.
So you can do this to skip the first 12
{# skip the first 12 blocks #}
{% for contentBlock in matrixField.offset(12) %}
  ...
{% endfor %}


---

### Answer by username_0 on 2015-02-10. Score: 2

I managed to solve this by using this...

`{% for contentBlock in matrixField.id('>=237') %}`

In reality 237 is defined in a segment.

But it occurred to me that the ID of the block isn't necessarily the order of the block within the Matrix - for example if I add a new block and that's given an ID of 200, and I drag it up - it still remains as 200.

`ID != Position`

So to resolve this I took advantage of `loop.index0` to identify the true order of the row. I then wrap the switch statement within a conditional...

`{% if loop.index0>=craft.request.getSegment(3) %}`

Now I can output only the rows after the page break.


---

