Created
July 16, 2018 19:47
-
-
Save dimobelov/9918fcd154f1f3819f3c0fb33f0abbf2 to your computer and use it in GitHub Desktop.
New paginator for Bludit with move
This file contains hidden or 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
<!-- Paginator --> | |
<?php if (Paginator::amountOfPages()>1):?> | |
<div id="paginator"> | |
<ul class="pagination justify-content-center"> | |
<?php | |
// Show previus page link | |
if(Paginator::showPrev()) { | |
echo '<li class="page-item"><a href="'.Paginator::prevPageUrl().'"><span class="page-link">'.$Language->g('Previous').'</span></a></li>'; | |
} else { | |
echo '<li class="page-item disabled"><span class="page-link">'.$Language->g('Previous').'</span></li>'; | |
} | |
//max 9 pages with move | |
$pmax = max(Paginator::currentPage() + 4, 9); | |
$pmin = min(Paginator::currentPage() - 4, Paginator::amountOfPages()-8); | |
?> | |
<?php for ($i = max(1, $pmin); $i <= min($pmax,Paginator::amountOfPages()); $i++): ?> | |
<?php if(Paginator::currentPage() == $i): ?> | |
<li class="page-item active"> | |
<span class="page-link"> | |
<?php echo $i ?> | |
</span> | |
</li> | |
<?php else: ?> | |
<li class="page-item"> | |
<a class="page-link" href="<?php echo Paginator::numberUrl($i) ?>"> | |
<?php echo $i ?> | |
</a> | |
</li> | |
<?php endif; ?> | |
<?php endfor; | |
// Show next page link | |
if(Paginator::showNext()) { | |
echo '<li class="page-item"><a href="'.Paginator::nextPageUrl().'"><span class="page-link">'.$Language->g('Next').'</span></a></li>'; | |
} else { | |
echo '<li class="page-item disabled"><span class="page-link">'.$Language->g('Next').'</span></li>'; | |
} | |
?> | |
</ul> | |
</div> | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment