| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/b2b2c/inc/ |
Upload File : |
<?php
function pagenav() {
global $limit,$start,$numpage,$page,$year;
//$parameters = "&year=".$year;
$parameters = "";
echo "<nav class='page_nav'>";
echo "<ul class='pages'>";
//previous set page
if($numpage > 5 && $start > (2*$limit)){
$newstart = $start-5*$limit;
if($newstart <=0){
$newstart = 0;
}
}
//previous page
$newstart ="";
if ($start-1 <= 0) {
$newstart = 0;
}else{
$newstart = $start-$limit;
}
echo "<li class='pgPrev'><a href='".$page."?start=".$newstart.$parameters."'><</a></li>";
//current page > 3
if($start/$limit >= 2){
for ($i=(($start/$limit)-2);$i<(($start/$limit)+3);$i++) {
if ((($i)*$limit)==$start) {
echo "<li class='page-number pgCurrent'><a>".($i+1)."</a></li>";
} else {
if($i >= 0 && $i < $numpage){
$newstart=($i)*$limit;
echo "<li class='page-number'><a href='".$page."?start=".$newstart.$parameters."'>".($i+1)."</a></li>";
}
}
}
}else{
for ($i=0;$i<5;$i++) {
if($i >= 0 && $i < $numpage){
if ((($i)*$limit)==$start) {
echo "<li class='page-number pgCurrent'><a>".($i+1)."</a></li>";
} else {
$newstart=($i)*$limit;
echo "<li class='page-number'><a href='".$page."?start=".$newstart.$parameters."'>".($i+1)."</a></li>";
}
}
}
}
//next page
if ($start<$limit*($numpage-1)) {
$newstart=$start+$limit;
echo "<li class='pgNext'><a href='".$page."?start=".$newstart.$parameters."' >></a></li>";
}
//next set page
if($start/$limit >= 3){
if(($start/$limit)+3 <= $numpage){
$newstart=$start+5*$limit;
}
}
echo "</ul>";
echo "</nav>";
} // END FUNCTION
if ($numpage>1) {
pagenav();
}
?>