We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem

Next and Previous Items

How do I display the next button to the right hand side and the previous link to the left hand side?

Currently when both links are displayed the next link is displayed on the left and previous is on the right.

I just need it switched:

My template is like this:

<a href="<perch:content id="slug" for="heading" type="slug" />">
    <perch:if exists="is_prev">Previous<perch:else />Next</perch:if>
</a>

My Code is this:

<?php
perch_content_custom('Cruising Ropes', array(
    'template'   => 'prevnext.html',
    'page'       => '/kingfisher/cruising-ropes/index.php',
    'filter'     => '_order',
    'match'      => 'gt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'ASC',
    'count'      => 1,
));

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

perch_content_custom('Cruising Ropes', array(
    'template'   => 'prevnext.html',
    'page'       => '/kingfisher/cruising-ropes/index.php',
    'filter'     => '_order',
    'match'      => 'lt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'DESC',
    'count'      => 1,
));
?>
Fishtank Creative

Fishtank Creative 2 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Just switch them.

<?php
PerchSystem::set_var('is_prev', true);

perch_content_custom('Cruising Ropes', array(
    'template'   => 'prevnext.html',
    'page'       => '/kingfisher/cruising-ropes/index.php',
    'filter'     => '_order',
    'match'      => 'lt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'DESC',
    'count'      => 1,
));

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

perch_content_custom('Cruising Ropes', array(
    'template'   => 'prevnext.html',
    'page'       => '/kingfisher/cruising-ropes/index.php',
    'filter'     => '_order',
    'match'      => 'gt',
    'value'      => $result[0]['_sortvalue'],
    'sort'       => '_order',
    'sort-order' => 'ASC',
    'count'      => 1,
));
?>