From 983dc20f60fda98dbe2dd472701698dda0ab9165 Mon Sep 17 00:00:00 2001 From: dignajar Date: Wed, 20 Jan 2016 23:16:32 -0300 Subject: [PATCH] Improves on Paginator --- bl-kernel/helpers/paginator.class.php | 52 ++++++++++++++++++------- bl-kernel/url.class.php | 9 +++++ bl-themes/future-imperfect/php/home.php | 4 +- index.php | 2 + 4 files changed, 50 insertions(+), 17 deletions(-) diff --git a/bl-kernel/helpers/paginator.class.php b/bl-kernel/helpers/paginator.class.php index b562c370..daf617e5 100644 --- a/bl-kernel/helpers/paginator.class.php +++ b/bl-kernel/helpers/paginator.class.php @@ -24,21 +24,43 @@ class Paginator { return self::$pager[$key]; } + public static function urlNextPage() + { + global $Url; + + $domain = trim(DOMAIN_BASE,'/'); + $filter = trim($Url->activeFilter(), '/'); + + if(empty($filter)) { + $url = $domain.'/'.$Url->slug(); + } + else { + $url = $domain.'/'.$filter.'/'.$Url->slug(); + } + + return $url.'?page='.self::get('nextPage'); + } + + public static function urlPrevPage() + { + global $Url; + + $domain = trim(DOMAIN_BASE,'/'); + $filter = trim($Url->activeFilter(), '/'); + + if(empty($filter)) { + $url = $domain.'/'.$Url->slug(); + } + else { + $url = $domain.'/'.$filter.'/'.$Url->slug(); + } + + return $url.'?page='.self::get('prevPage'); + } + public static function html($textPrevPage=false, $textNextPage=false, $showPageNumber=false) { global $Language; - global $Url; - - $url = trim(DOMAIN_BASE,'/'); - - $filter = ''; - if($Url->whereAmI()=='tag') { - $filter = trim($Url->filters('tag'), '/'); - $url = $url.'/'.$filter.'/'.$Url->slug(); - } - else { - $url = $url.'/'; - } $html = '
'; $html .= '