/**
* Get page number navigation HTML
* @param $pageNum: current page number
* @param $pageSize: number of each page
* @param $rowCount: total number of records
* @param $navUrl : Link page URL
*/
function getNavHtml($pageNum,$pageSize,$ rowCount,$navUrl){
$pageCount = (int)($rowCount/$pageSize); //Total number of pages
if ($rowCount % $pageSize >0){
$pageCount++;
}
if ($pageNum>$pageCount){
$pageNum = 1;
}
$firstNav = "
Home ";
$lastNav = "
Last page ";
$prevNav=" ";
$nextNav="";
if ($pageNum>1){
$navPageNum = $pageNum-1;
$prevNav = "
Previous page ";
}
if ($pageNum<$pageCount && $pageCount>1){
$navPageNum = $pageNum+1 ;
$nextNav = "
Next page ";
}
$amongNav="";
//Key loop
for ($i=1;$i<=5;$i++){
$navPageNum = $pageNum+ $i-3;
if ($navPageNum>0 && $navPageNum<=$pageCount){
$navCss = $navPageNum == $pageNum?" class="hover"":"";
$amongNav.="
{$navPageNum} ";
}
}
return $firstNav.$prevNav.$amongNav.$nextNav .$lastNav." ".$pageNum."/".$pageCount." There are [".$rowCount."] pieces of data";
}
}