Skip to content

Instantly share code, notes, and snippets.

@StephanWeinhold
Created June 5, 2018 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StephanWeinhold/8c97efe6862abb7a246ad94dbf4a09fb to your computer and use it in GitHub Desktop.
Save StephanWeinhold/8c97efe6862abb7a246ad94dbf4a09fb to your computer and use it in GitHub Desktop.
Numbered pagination for Datenstrom's Yellow CMS. https://github.com/datenstrom/yellow
<?php list($name, $pages) = $yellow->getSnippetArgs() ?>
<?php if($pages->isPagination()): ?>
<div class="pagination">
<?php if($pages->getPaginationPrevious()): ?>
<a class="previous" href="<?php echo $pages->getPaginationPrevious() ?>"><?php echo $yellow->text->getHtml("paginationPrevious") ?></a>
<?php endif ?>
<?php if($pages->getPaginationCount() > 1): ?>
<?php for($i = 1; $i <= $pages->getPaginationCount(); ++$i): ?>
<a class="pagination-number<?php if ($i == $pages->getPaginationNumber()) echo " active" ?>" href="<?php echo $pages->getPaginationLocation(true, $i) ?>"><?php echo $i ?></a>
<?php endfor ?>
<?php endif ?>
<?php if($pages->getPaginationNext()): ?>
<a class="next" href="<?php echo $pages->getPaginationNext() ?>"><?php echo $yellow->text->getHtml("paginationNext") ?></a>
<?php endif ?>
</div>
<?php endif ?>
@StephanWeinhold
Copy link
Author

StephanWeinhold commented Jun 5, 2018

Just replace /system/themes/snippets/pagination.php with this file. I've tried to use the template coding style of the fine guys at Datenstrom - may the Clean Code-God have mercy with my soul :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment