PHP Classic Paging Support 10 page DOWN 10 code
+-------------------------------------------
|
| Autohr:jimmy
| Email:mailangel123@163.com
|
+-------------------------------------------
*/
/*
+-------------------------------------------
+ Configuration not front page
+-------------------------------------------
*/
if (@! $perpage | |!is_numeric (@ $perpage) | | | @ $perpage <= 0) {
$perpage = 20;
}
/*
+-------------------------------------------
+ Statistics maximum page TDS record Total bar data
+-------------------------------------------
*/
$pages = Ceil ($tds/$perpage);
/*
+-------------------------------------------
+ Statistics Max page
+-------------------------------------------
*/
$page = $page > $pages? $pages: $page;
$page = Is_numeric ($page) && $page > 0? Ceil ($page/1): 1;
/*
+-------------------------------------------
+ How many records to take
+-------------------------------------------
*/
$pages _limit = ($page-1) * $perpage;
$pages _offset = $perpage;
/*
+-------------------------------------------
+ Start Page and end page
+-------------------------------------------
*/
if ($pages <= 10) {
$spage = 1;
$epage = $pages;
}else{
if ($page > $pages-5) {
$spage = $pages-9;
$epage = $pages;
}elseif ($page < 6) {
$spage = 1;
$epage = 10;
}else{
$spage = $page-4;
$epage = $page + 5;
}
}
/*
+-------------------------------------------
+ Previous page and next page
+-------------------------------------------
*/
$pages _prev = $page <= 2? 1: ($page-1);
$pages _next = $page >= $pages-1? $pages: ($page + 1);