<p>You should actually go to /p2 - this has been a bug in some 2.4 releases, so can you tell me if you are on the latest version?</p>

CC BY-SA 3.0
2015-06-13T03:20:54.890Z
Yup, you're right, there was one update, and after I ran that it started working. before the update the links were pointing to /2 and now with build 2.4.2669 they point to /p2. Thanks!
Kenyon Kowal
CC BY-SA 3.0
2015-06-12T06:54:28.950Z
2015-06-12T06:54:28.950Z
Bob Olde Hampsink
<p>The <code>{% paginate %}</code> tag requires the ElementCriteriaModel to be passed through first.</p>

<p>Since you were requesting <code>entry.images.limit(20)</code> to be paginated, I suspect you have your images set up within a single images asset. Instead you will need to set up your images within a channel or structure if you would like Craft to paginate the gallery between several pages.</p>

<p>This hasn't been tested, although spot the differences with the inclusion of the <code>craft</code> prefix within the ElementCriteriaModel.</p>

<pre><code>{% paginate craft.entries.section("gallery").limit(20) as imagesOnPage %}

    {% for entry in imagesOnPage %}
        &lt;div class="thumb col-1-4"&gt;
&lt;a href="{{ entry.image.getUrl() }}" data-fresco-group="{{ entry.id }}" data-fresco-caption="{{ entry.image.title }}" title="{{ entry.image.title }}" class="fresco"&gt;
                &lt;img src="{{ entry.image.getUrl('galleryThumbnail') }}" title="{{ entry.image.title }}" alt="{{ entry.image.title }}"&gt;
            &lt;/a&gt;
        &lt;/div&gt;
    {% endfor %}

  &lt;div class="pagination"&gt;
    {% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}" class="prev"&gt;◄&lt;/a&gt;{% endif %}

    {% for page, url in paginate.getPrevUrls(5) %}
        &lt;a href="{{ url }}"&gt;{{ page }}&lt;/a&gt;
    {% endfor %}

    &lt;span class="current"&gt;{{ paginate.currentPage }}&lt;/span&gt;

    {% for page, url in paginate.getNextUrls(5)  %}
        &lt;a href="{{ url }}" class="page-numbers"&gt;{{ page }}&lt;/a&gt;
    {% endfor %}

    {% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}" class="next"&gt;►&lt;/a&gt;{% endif %}

  &lt;/div&gt;
{% endpaginate %}`
</code></pre>

<p>Sources: <a href="http://buildwithcraft.com/docs/templating/paginate" rel="nofollow">http://buildwithcraft.com/docs/templating/paginate</a>,
<a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel" rel="nofollow">http://buildwithcraft.com/docs/templating/elementcriteriamodel</a></p>

CC BY-SA 3.0
2015-06-12T06:54:42.923Z
entry.images.limit(20) is an ElementCriteriaModel just as well
Bob Olde Hampsink
CC BY-SA 3.0
2015-06-11T23:32:19.410Z
2015-06-11T23:37:42.780Z
2015-06-11T23:37:42.780Z
Timothy Ingram
<p>I am setting up a photo gallery and below is what I have right now. My problem is when I go the next page /2 it says that entry does not exist. I have routes set up as /gallery/slug/*, and pointing to this template.</p>

<p>Is there a way to paginate images like this?</p>

<pre><code> {% paginate entry.images.limit(20) as imagesOnPage %}
  {% for image in imagesOnPage %}
    &lt;div class="thumb col-1-4"&gt;
        &lt;a href="{{ image.getUrl() }}" data-fresco-group="{{ entry.id }}" data-fresco-caption="{{ image.title }}" title="{{ image.title }}" class="fresco"&gt;
                &lt;img src="{{ image.getUrl('galleryThumbnail') }}" title="{{ image.title }}" alt="{{ image.title }}"&gt;
          &lt;/a&gt;
    &lt;/div&gt;
  {% endfor %}

  &lt;div class="pagination"&gt;
    {% if paginate.prevUrl %}&lt;a href="{{ paginate.prevUrl }}" class="prev"&gt;◄&lt;/a&gt;{% endif %}

    {% for page, url in paginate.getPrevUrls(5) %}
        &lt;a href="{{ url }}"&gt;{{ page }}&lt;/a&gt;
    {% endfor %}

    &lt;span class="current"&gt;{{ paginate.currentPage }}&lt;/span&gt;

    {% for page, url in paginate.getNextUrls(5)  %}
        &lt;a href="{{ url }}" class="page-numbers"&gt;{{ page }}&lt;/a&gt;
    {% endfor %}

    {% if paginate.nextUrl %}&lt;a href="{{ paginate.nextUrl }}" class="next"&gt;►&lt;/a&gt;{% endif %}

  &lt;/div&gt;
{% endpaginate %}
</code></pre>

<pagination><gallery>
Paginate Assets
# Paginate Assets

(Asked by: username_0 on 2015-06-11)

I am setting up a photo gallery and below is what I have right now. My problem is when I go the next page /2 it says that entry does not exist. I have routes set up as /gallery/slug/*, and pointing to this template.
Is there a way to paginate images like this?
 {% paginate entry.images.limit(20) as imagesOnPage %}
  {% for image in imagesOnPage %}
    
        
                
          
    
  {% endfor %}

  
    {% if paginate.prevUrl %}◄{% endif %}

    {% for page, url in paginate.getPrevUrls(5) %}
        {{ page }}
    {% endfor %}

    {{ paginate.currentPage }}

    {% for page, url in paginate.getNextUrls(5)  %}
        {{ page }}
    {% endfor %}

    {% if paginate.nextUrl %}►{% endif %}

  
{% endpaginate %}

**Tags:** pagination, gallery


---

## 2 answers

### Answer by username_1 on 2015-06-12. Score: 0 | Accepted answer

You should actually go to /p2 - this has been a bug in some 2.4 releases, so can you tell me if you are on the latest version?

> **Comments:**
> **username_0**: Yup, you're right, there was one update, and after I ran that it started working. before the update the links were pointing to /2 and now with build 2.4.2669 they point to /p2. Thanks!  

---

### Answer by username_2 on 2015-06-11. Score: 2

The {% paginate %} tag requires the ElementCriteriaModel to be passed through first.
Since you were requesting entry.images.limit(20) to be paginated, I suspect you have your images set up within a single images asset. Instead you will need to set up your images within a channel or structure if you would like Craft to paginate the gallery between several pages.
This hasn't been tested, although spot the differences with the inclusion of the craft prefix within the ElementCriteriaModel.
{% paginate craft.entries.section("gallery").limit(20) as imagesOnPage %}

    {% for entry in imagesOnPage %}
        

                
            
        
    {% endfor %}

  
    {% if paginate.prevUrl %}◄{% endif %}

    {% for page, url in paginate.getPrevUrls(5) %}
        {{ page }}
    {% endfor %}

    {{ paginate.currentPage }}

    {% for page, url in paginate.getNextUrls(5)  %}
        {{ page }}
    {% endfor %}

    {% if paginate.nextUrl %}►{% endif %}

  
{% endpaginate %}`

Sources: http://buildwithcraft.com/docs/templating/paginate,
http://buildwithcraft.com/docs/templating/elementcriteriamodel

> **Comments:**
> **username_1**: entry.images.limit(20) is an ElementCriteriaModel just as well  

---

