Search code examples
phpexpressionengine

ExpressionEngine Pagination issue with 2 segments


I’m building a site that has the following URI structures:

domain.com/case-studies - this page loads ALL case studies and pagination works fine as there is only one segment.

domain.com/case-studies/residential - this uses seg2cat on category_2 to load the case studies for residential. If there are more than 6, I click the next page and get the URI domain.com/case-studies/residential/P6

This TOTALLY breaks the page and I get “Error, The page your requested was not found”

Here is the pagination code I’m using:

{exp:channel:entries channel="case_study" category="{segment_2_category_id}” orderby=”date” sort=”desc” paginate=”bottom” limit=”6” dynamic=”yes”}

{paginate} <nav> <ul class=”pager”> {if previous_page} <li class=”previous”>← Older</li> {/if} {if next_page} <li class=”next”>Newer →</li> {/if} </ul> </nav> {/paginate}

I’m totally stuck, can anyone help at all?


Solution

  • In order for this to work, I had to set my channel entries tag to dynamic="no" and also set a custom template route for my Case Studies template like this /case-studies/{category:alpha_dash}/{page:pagination}

    Works fine!

    Andy