Merge branch 'feature/issue_#11_adding_next_and_previous_page_buttons' of https://github.com/sergiotarxz/micro
This commit is contained in:
commit
b1cc92a233
49
php/home.php
49
php/home.php
@ -32,13 +32,46 @@
|
|||||||
|
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<?php
|
<?php
|
||||||
if (Paginator::showPrev()) {
|
|
||||||
echo '<li class="float-left"><a href="'.Paginator::previousPageUrl().'">'.$L->get('Previous page').'</a></li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Paginator::showNext()) {
|
$isPage = $WHERE_AM_I === 'page';
|
||||||
echo '<li class="float-right"><a href="'.Paginator::nextPageUrl().'">'.$L->get('Next page').'</a></li>';
|
$isHome = $WHERE_AM_I === 'home';
|
||||||
}
|
$pageHandler = new Pages();
|
||||||
?>
|
$previousLink = null;
|
||||||
|
$nextLink = null;
|
||||||
|
$areTherePages = !!count($content);
|
||||||
|
if ( $isPage && $areTherePages ) {
|
||||||
|
$currentPage = $content[0];
|
||||||
|
if( isset($currentPage) ) {
|
||||||
|
if ( $currentPage->previousKey() ) {
|
||||||
|
$previousLink = buildPage($currentPage->previousKey())->permalink();
|
||||||
|
}
|
||||||
|
if ( $currentPage->nextKey() ) {
|
||||||
|
$nextLink = buildPage($currentPage->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>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user