We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pagination displays no entries after the first page

Development and Programming

tvr1982's avatar
tvr1982
2 posts
9 years ago
tvr1982's avatar tvr1982

Hope this is the right area of the forum for this.

We have a blog section on our website that displays 10 entries per page however, when you click next page or ‘2’ it returns an empty page with a /P10 in the URL.

From what I can see the code is the same as for our news page and that’s working fine. I’ve looked through similar issues on the forums but can’t find a fix that works.

The code for the entries is:

{exp:channel:entries channel="blog" orderby="date" paginate="bottom" limit="10" {if segment_2}author_id="{segment_2}"{/if}  dynamic="no"}

And the code for the pagination is:

{paginate}

Showing page {current_page} of {total_pages} <span>{pagination_links}</span>
{/paginate}

Can anyone see what would be causing the issue?

Let me know if there’s any more info you’d need.

       
Stephen T's avatar
Stephen T
127 posts
9 years ago
Stephen T's avatar Stephen T

Hi tvr1982,

What do the full URL segments look like for the blog section with the pagination segment? For example, is it just /blog/P10? If so then the {if segment_2} conditional in the channel entries tag would be interfering with the pagination segment because it’s trying to use P10 to find an author ID.

       
tvr1982's avatar
tvr1982
2 posts
9 years ago
tvr1982's avatar tvr1982

Thanks Stephen, I hadn’t realised that was what that related to, I’m sure it hadn’t caused an issue until recently though which seems strange.

I’ve changed the author_id to {segment_3} and amended the code for the authors section to the following

{exp:top_authors channel="blog"}
                                <li><a href="/blog/author/{author_id}">{name} ({count})</a> </li>
                            {/exp:top_authors}

adding in the “/author/” segment after the /blog/ and this has fixed the issue, pagination works and the author filter works.

Do you think writing it like this could cause any other issues?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.