Pequenio/php/pagination.php

43 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<!-- Pagination -->
<ul class="pagination">
<?php
$isPage = $WHERE_AM_I === 'page';
$isHome = $WHERE_AM_I === 'home';
$pageHandler = new Pages();
$previousLink = null;
$nextLink = null;
if ( $isPage && isset($page) ) {
if( isset($page) ) {
if ( $page->previousKey() ) {
$previousLink = buildPage($page->previousKey())->permalink();
}
if ( $page->nextKey() ) {
$nextLink = buildPage($page->nextKey())->permalink();
}
}
}
if ( $isHome ) {
if ( Paginator::showPrev() ) {
$previousLink = Paginator::previousPageUrl();
}
if ( Paginator::showNext() ) {
$nextLink = Paginator::nextPageUrl();
}
}
?>
<?php if ( isset($previousLink) ): ?>
<li class="float-left">
<a href="<?php echo htmlentities( $previousLink, ENT_QUOTES | ENT_HTML401 ); ?>">
<?php echo $L->get('Previous page') ?>
</a>
</li>
<?php endif; ?>
<?php if ( isset($nextLink) ): ?>
<li class="float-right">
<a href="<?php echo htmlentities( $nextLink, ENT_QUOTES | ENT_HTML401 ); ?>">
<?php echo $L->get('Next page') ?>
</a>
</li>
<?php endif; ?>
</ul>