Skip to content

Instantly share code, notes, and snippets.

@rizkysyazuli
Created September 30, 2013 20:41
Show Gist options
  • Save rizkysyazuli/6769957 to your computer and use it in GitHub Desktop.
Save rizkysyazuli/6769957 to your computer and use it in GitHub Desktop.
Kirby CMS Snippets: pagination with page numbers.
<? if ($articles->pagination()->hasPages()): ?>
<ul class="pagination">
<? if($articles->pagination()->hasNextPage()): ?>
<li><a class="prev" href="<?= $articles->pagination()->nextPageURL() ?>">Older posts</a></li>
<? endif; ?>
<? foreach($articles->pagination()->range(5) as $paging): ?>
<li><a href="<?= $articles->pagination()->pageURL($paging); ?>"><?= $paging; ?></a></li>
<? endforeach ?>
<? if($articles->pagination()->hasPrevPage()): ?>
<li><a class="next" href="<?= $articles->pagination()->prevPageURL() ?>">Newer posts</a></li>
<? endif; ?>
</ul>
<? endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment