$pagination->hasPrevPage()

Checks if there is a previous page

  • return (boolean)

Example

<?php

$subpages   = $page->children()->paginate(10);
$pagination = $subpages->pagination();

?>

<!-- foreach loop with subpages -->

<?php if($pagination->hasPrevPage()): ?>
<a href="<?php echo $pagination->prevPageUrl() ?>">
  prev (<?php echo $pagination->prevPage() ?>)
</a>
<?php endif ?>

<?php if($pagination->hasNextPage()): ?>
<a href="<?php echo $pagination->nextPageUrl() ?>">
  next (<?php echo $pagination->nextPage() ?>)
</a>
<?php endif ?>