Currently on a site using Structure. I've run into a brainteaser I hope someone maybe able to help out with.
The site itself makes use of Structures child pages. In my case these child pages relate to Recipes. ie. the parent page would be Recipes with a child of Main Courses, which would then have child pages of Fish courses, Pasta courses etc. In the publish form of these child pages I have a Playa field, which link documents/recipes from my documents channel.
Thats all fine, but some child pages have a lot of related documents assigned to them, so I want to integrate pagination if possible to avoid long scrolling pages.
This is the bare bones of my markup
{exp:channel:entries status="not closed" dynamic="on"}
{if related_docs}<!--My Playa field-->
{exp:playa:children
channel="documents"
disable="categories|category_fields|member_data"
orderby="title"
sort="asc"
limit="5"
var_prefix="pages"
paginate_base="/{segment_1}/{segment_2}/{segment_3}"
paginate="bottom"}
<h5>{pages:title}</h5>
<!--Pagination start-->
{pages:paginate}
{pagination_links}
<ul>
{first_page}
<li><a href="{pagination_url}" class="page-first">First Page</a></li>
{/first_page}
{previous_page}
<li><a href="{pagination_url}" class="page-previous">Previous Page</a></li>
{/previous_page}
{page}
<li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
{/page}
{next_page}
<li><a href="{pagination_url}" class="page-next">Next Page</a></li>
{/next_page}
{last_page}
<li><a href="{pagination_url}" class="page-last">Last Page</a></li>
{/last_page}
</ul>
{/pagination_links}
{/pages:paginate}
{/exp:playa:children}
{if:else}
<p style="padding:15px;">Currently no resources for this area</p>
{/if}
{/exp:channel:entries}
I have read about using pagination within a Playa field, hence the inclusion of var_prefix
. But the pagination just doesn't seem to be working.
Right now if I navigate to my Structure child page with the related entries displayed, the URL is domain.com/recipes/main-courses/meat-dishes/
.
Using the default pagination_url
, this takes me to domain.com/recipes/main-courses/meat-dishes/P5
. Which implies the pagination URL's are being correctly applied. But when I click on the next page I am merely taken to the homepage, with the P5
paginated url.
Am I missing something glaringly obvious with this one. Has anyone had any success with this or can someone point me in the right direction.