Forum
Pagination page links template not showing on search results
Hi
I'm trying to create a pagination on the bottom of the search results pages like so...
...but nothing is displaying.
Search page code /perch/templates/pages/search.php
$query = perch_get('q');
perch_content_search($query, [
'count' => 10,
'hide-default-doc' => 'true',
'template' => 'search-result.html',
'paginate' => 'true',
'page-links' => 'true',
]);
Search results template /perch/templates/search/search-result.html
<perch:if exists="paging">
<perch:content id="page_links" encode="false" />
</perch:if>
Pagination template `/perch/templates/paination/page-links.html
<perch:before>
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center pagination-lg">
<li class="page-item<perch:if id="not_first_page"> disabled</perch:if>"><a class="page-link" href="<perch:search id="prev_url" encode="false" />" tabindex="-1"><i class="fal fa-arrow-left"></i></a></li>
</perch:before>
<li<perch:if exists="selected"> class="active"</perch:if>><a href="<perch:pages id="url" />"><perch:pages id="page_number" /></a></li>
<perch:after>
<li class="page-item<perch:if id="not_last_page"> disabled</perch:if>"><a class="page-link" href="<perch:search id="next_url" encode="false" />"><i class="fal fa-arrow-right"></i></a></li>
</ul>
</nav>
</perch:after>
Debug isn't showing any errors.
Many thanks
What does
<perch:showall />
output? Do you see the pagination variables?Hi Drew.
It looks like they're there...
If you look at the last line:
That tells you that you should be using
<perch:search />
tags in this context, and it looks like you're using<perch:content />