Skip to content

Kirby 5.0.4

$pagination->prevPageUrl()

Returns the Url for the previous page. Returns null if there's no previous page.

$pagination->prevPageUrl(): string|null

Return types

stringornull

This method modifies the existing $pagination object it is applied to and returns it again.

Parent class

Kirby\Cms\Pagination

Examples

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

<!-- foreach loop with subpages -->

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

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