<p>You could create a form/a link with the limit and add the parameter in your <code>$_GET</code> request or as a <a href="https://craftcms.com/docs/templating/craft.request#segments" rel="nofollow noreferrer">segment</a> to your url. This is just an example how to use it.</p>

<pre><code>How many Entries would you like to get?
&lt;a href="/?limit=10"&gt;10&lt;/a&gt;
&lt;a href="/?limit=20"&gt;20&lt;/a&gt;
&lt;a href="/?limit=30"&gt;30&lt;/a&gt;
</code></pre>

<p>Then you can fetch this parameter</p>

<pre><code>{% set limit = craft.request.getQuery('limit', 10) %}
{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(limit) as pageInfo, pageItems %}
</code></pre>

<p>Of course you have to attach this parameter to your paginate links as well</p>

<pre><code>{% if pageInfo.prevUrl %}&lt;a href="{{ pageInfo.prevUrl }}?limit={{ limit }}"&gt;Previous Page&lt;/a&gt;{% endif %}
</code></pre>

<p>There are definitely better solutions but they require more time and more effort and a plugin/php but this would be the easiest solution </p>

CC BY-SA 3.0
2018-03-27T18:02:34.193Z
2018-03-27T18:02:34.193Z
Robin Schambach
<p>I am building a pagination layout limiting the content to 10 because, well, it makes sense to break down large amounts of content to smaller chunks.</p>

<p>But as there is so much, a user might want to toggle how many they want to see. But because the pagination limit is done in the twig variables, is there a built in method for updating this on user interactions?</p>

<p>Standard CraftCMS pagination code:</p>

<pre><code>{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(10) as pageInfo, pageItems %}
</code></pre>

<p>Cheers</p>

<forloop><pagination><loop><limit>
Allowing the user to update a CraftCMS pagination limit with listing filter options
# Allowing the user to update a CraftCMS pagination limit with listing filter options

(Asked by: username_0 on 2018-03-27)

I am building a pagination layout limiting the content to 10 because, well, it makes sense to break down large amounts of content to smaller chunks.
But as there is so much, a user might want to toggle how many they want to see. But because the pagination limit is done in the twig variables, is there a built in method for updating this on user interactions?
Standard CraftCMS pagination code:
{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(10) as pageInfo, pageItems %}

Cheers

**Tags:** forloop, pagination, loop, limit


---

## 1 answers

### Answer by username_1 on 2018-03-27. Score: 2 | Accepted answer

You could create a form/a link with the limit and add the parameter in your $_GET request or as a segment to your url. This is just an example how to use it.
How many Entries would you like to get?
10
20
30

Then you can fetch this parameter
{% set limit = craft.request.getQuery('limit', 10) %}
{% paginate craft.entries.section(entry.slug).order('postDate desc').with: ['image'].limit(limit) as pageInfo, pageItems %}

Of course you have to attach this parameter to your paginate links as well
{% if pageInfo.prevUrl %}Previous Page{% endif %}

There are definitely better solutions but they require more time and more effort and a plugin/php but this would be the easiest solution


---

