From 9f1bf68d9bb73718add1e5fd723dd398fad142fb Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Wed, 22 Jul 2020 22:10:13 +0200 Subject: [PATCH 1/4] Adding next/previous page buttons. issue #11 --- php/home.php | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/php/home.php b/php/home.php index 9612ec1..309c809 100644 --- a/php/home.php +++ b/php/home.php @@ -23,13 +23,48 @@ From 66f9dbab26a52ebab77e8c328d88e32b4716e193 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Wed, 22 Jul 2020 22:12:56 +0200 Subject: [PATCH 2/4] Useless conditional removed. issue #11 --- php/home.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/php/home.php b/php/home.php index 309c809..f5e27c4 100644 --- a/php/home.php +++ b/php/home.php @@ -31,25 +31,23 @@ $pageHandler = new Pages(); $previousLink = null; $nextLink = null; $areTherePages = !!count($content); -if ( ( $isPage || $isHome ) ) { - 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 ( $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(); - } +} +if ( $isHome ) { + if ( Paginator::showPrev() ) { + $previousLink = Paginator::previousPageUrl(); + } + if ( Paginator::showNext() ) { + $nextLink = Paginator::nextPageUrl(); } } ?> From 4c4541e15c214885e4889291a99a3baadd0c43d5 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Wed, 22 Jul 2020 22:14:36 +0200 Subject: [PATCH 3/4] Prettyifing the code, previously there was a bad indentation. issue #11 --- php/home.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/php/home.php b/php/home.php index f5e27c4..0cdb9d8 100644 --- a/php/home.php +++ b/php/home.php @@ -23,34 +23,34 @@