Forum

Thread tagged as: Question, Problem

Prev and Next Links

I am using the two page list/detail method.

On my detail page I wish to create prev/next links to other detail pages like this (urls not actual yet).

<div class="w-pagehead-nav-h">
<a class="w-pagehead-nav-item type_prev" href="prev_url"></a>
<a class="w-pagehead-nav-item type_all" href="/portfolio"></a>
<a class="w-pagehead-nav-item type_next" href="next_url"></a>
</div>

Based on your solution for prev/next I have added this to the detail.php page:

<?php perch_content_custom('Portfolio', array(
    'template'   => 'prev-next.html',
    'filter'     => '_order',
    'match'      => 'gt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'ASC',
    'count'      => 1,
));

PerchSystem::set_var('is_prev', true);

perch_content_custom('Portfolio', array(
    'template'   => 'prev-next.html',
    'filter'     => '_order',
    'match'      => 'lt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'DESC',
    'count'      => 1,
)); ?>

However:

  1. Not sure what to put into urls above.
  2. Not sure if the above perch code is in right file.
Nigel Coath

Nigel Coath 1 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

  1. What format should the URL take?

  2. Does it work?