Created
November 8, 2013 09:57
-
-
Save snetty/7368825 to your computer and use it in GitHub Desktop.
Lemonstand Pagination for Bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$curPageIndex = $pagination->getCurrentPageIndex(); | |
$pageNumber = $pagination->getPageCount(); | |
$suffix = isset($suffix) ? $suffix : null; | |
?> | |
<? if($pageNumber != 1) : ?> | |
<div class="text-center"> | |
<ul class="pagination"> | |
<li> | |
<a href="#" class="disabled"> | |
Page <strong><?= !$curPageIndex ? 1 : $curPageIndex+1 ?> </strong> | |
of <strong><?= $pageNumber ?></strong> | |
</a> | |
</li> | |
<li><a class="<? if(!$curPageIndex) : ?>disabled<? endif; ?>" href="<?= $base_url.$suffix ?>" title="First Page">«</a></li> | |
<li><a class="<? if(!$curPageIndex): ?>disabled<? endif; ?> href="<?= $base_url.'/'.$curPageIndex.$suffix ?>" title="Previous Page">‹</a></li> | |
<? if($pagination->getPageCount() > 1) : ?> | |
<? for ($i=1; $i<=$pageNumber; $i++): ?> | |
<? if((($curPageIndex+1) >= ($i-3)) && (($curPageIndex+1) <= ($i+3))) : ?> | |
<li><a class="<? if ($i == $curPageIndex+1): ?>active<? endif; ?>" href="<?= $base_url.'/'.$i.$suffix ?>"><?= $i ?></a></li> | |
<? endif; ?> | |
<? endfor ?> | |
<? endif; ?> | |
<li><a class="<? if($curPageIndex >= $pageNumber-1) : ?>disabled<? endif; ?>" href="<?= $base_url.'/'.($curPageIndex+2).$suffix ?>" title="Next Page">›</a></li> | |
<li><a class="<? if($curPageIndex == $pagination->getPageCount()-1) : ?>disabled<? endif; ?>" href="<?= $base_url.'/'.$pagination->getPageCount().$suffix ?>" title="Last Page">»</a></li> | |
</ul> | |
</div> | |
<? endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment