<p>That error is occurring at <code>entries.limit(10)</code>, because at that point <code>entries</code> is already an array of fetched entries, rather than an ElementCriteriaModel. (The entries will get fetched as soon as the ElementCriteriaModel is passed to your <code>|group</code> filter.)</p>

<p>The only way to grab just 10 entries per section (per page) will be to loop through each of your sections, and create a new ElementCriteriaModel for each one.</p>

<pre><code>{% set sections = {
    'news': 'News',
    'events': 'Events',
    // ...
} %}

{% for section, sectionName in sections %}

    {% set entries = craft.entries.section(section).limit(10) %}
    {% paginate entries as pageInfo, pageEntries %}

    {% if pageEntries|length %}
        &lt;h3&gt;{{ sectionName }}&lt;/h3&gt;

        {% for entry in pageEntries %}
            &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
        {% endfor %}
    {% endif %}

{% endfor %}
</code></pre>

<p>Note that Craft does not support multiple independently paginated lists of entries on a single webpage. So if you use the built-in <code>{% paginate %}</code> tag like this, when it takes you to page 2, all of the sections’ <code>{% paginate %}</code> tags will start showing page 2 content. And you’ll need to keep track of which section actually has the most pages, before building out your pagination nav.</p>

<pre><code>// ...

{% set primaryPageInfo = null %}

{% for section, sectionName in sections %}

    {% set entries = craft.entries.section(section).limit(10) %}
    {% paginate entries as pageInfo, pageEntries %}

    // ...

    {# Does this section have the most entries (so far)? #}
    {% if not primaryPageInfo or pageInfo.totalPages &gt; primaryPageInfo.totalPages %}
        {% set primaryPageInfo = pageInfo %}
    {% endif %}

{% endfor %}

{# Build out the pagination nav using the biggest section's pageInfo #}
&lt;a href="{{ primaryPageInfo.firstUrl }}"&gt;First Page&lt;/a&gt;
{% if primaryPageInfo.prevUrl %}&lt;a href="{{ primaryPageInfo.prevUrl }}"&gt;Previous Page&lt;/a&gt;{% endif %}
{% if primaryPageInfo.nextUrl %}&lt;a href="{{ primaryPageInfo.nextUrl }}"&gt;Next Page&lt;/a&gt;{% endif %}
&lt;a href="{{ primaryPageInfo.lastUrl }}"&gt;Last Page&lt;/a&gt;
</code></pre>

CC BY-SA 3.0
2016-04-05T11:33:28.810Z
2016-04-05T11:33:28.810Z
Brandon Kelly
<p>I am trying to paginate grouped entries as follows...</p>

<pre><code>{% set searchParam = craft.request.getParam('q') %}

{% set groups = craft.entries({
    search: searchParam
})|group('section') %}

{% for entries in groups %}
    {% paginate entries.limit(10) as pageEntries %}

    {% endpaginate %}
{% endfor %}
</code></pre>

<p>However it is throwing this error on the paginate line: <code>Array to string conversion</code></p>

<p>How else can I achieve this functionality?</p>

CC BY-SA 3.0
2015-04-17T11:53:09.760Z
Where do you want to break pages? After x entries or after x groups? If entries, a group from page 1 most likely gets continued on page 2 and you need additional group headings etc.?
carlcs
<entries><pagination><group>
Paginate Grouped Entries
# Paginate Grouped Entries

(Asked by: username_0 on 2015-04-17)

I am trying to paginate grouped entries as follows...
{% set searchParam = craft.request.getParam('q') %}

{% set groups = craft.entries({
    search: searchParam
})|group('section') %}

{% for entries in groups %}
    {% paginate entries.limit(10) as pageEntries %}

    {% endpaginate %}
{% endfor %}

However it is throwing this error on the paginate line: Array to string conversion
How else can I achieve this functionality?

**Tags:** entries, pagination, group

> **Comments:**
> **username_1**: Where do you want to break pages? After x entries or after x groups? If entries, a group from page 1 most likely gets continued on page 2 and you need additional group headings etc.?  

---

## 1 answers

### Answer by username_2 on 2016-04-05. Score: 2 | Accepted answer

That error is occurring at entries.limit(10), because at that point entries is already an array of fetched entries, rather than an ElementCriteriaModel. (The entries will get fetched as soon as the ElementCriteriaModel is passed to your |group filter.)
The only way to grab just 10 entries per section (per page) will be to loop through each of your sections, and create a new ElementCriteriaModel for each one.
{% set sections = {
    'news': 'News',
    'events': 'Events',
    // ...
} %}

{% for section, sectionName in sections %}

    {% set entries = craft.entries.section(section).limit(10) %}
    {% paginate entries as pageInfo, pageEntries %}

    {% if pageEntries|length %}
        {{ sectionName }}

        {% for entry in pageEntries %}
            {{ entry.title }}
        {% endfor %}
    {% endif %}

{% endfor %}

Note that Craft does not support multiple independently paginated lists of entries on a single webpage. So if you use the built-in {% paginate %} tag like this, when it takes you to page 2, all of the sections’ {% paginate %} tags will start showing page 2 content. And you’ll need to keep track of which section actually has the most pages, before building out your pagination nav.
// ...

{% set primaryPageInfo = null %}

{% for section, sectionName in sections %}

    {% set entries = craft.entries.section(section).limit(10) %}
    {% paginate entries as pageInfo, pageEntries %}

    // ...

    {# Does this section have the most entries (so far)? #}
    {% if not primaryPageInfo or pageInfo.totalPages > primaryPageInfo.totalPages %}
        {% set primaryPageInfo = pageInfo %}
    {% endif %}

{% endfor %}

{# Build out the pagination nav using the biggest section's pageInfo #}
First Page
{% if primaryPageInfo.prevUrl %}Previous Page{% endif %}
{% if primaryPageInfo.nextUrl %}Next Page{% endif %}
Last Page


---

