function pageSplit($startPos, $rowsPerPage = '', $totalRows = '' )
{
$numPages = $totalRows / $rowsPerPage ;
$tenthPages = $rowsPerPage * 10 ;
If($startPos >= $tenthPages )
{
$back10Position = $startPos - $tenthPages ;
$pageString .= '<< ';
}
if($startPos >= $rowsPerPage)
{
$backPosition = $startPos - $rowsPerPage;
$pageString .= 'Back ';
}
if($totalRows != '')
{
$page = ceil($startPos / $rowsPerPage);
$pageCount = $page + $numPages;
$PageNo = ceil($startPos / $rowsPerPage ) ;
// echo ' Page No ' . $PageNo ;
for($i = 1,$pgCnt=1; $page <= $pageCount; $i = $i + $rowsPerPage)
{
if ( $PageNo == $pgCnt )
{
$pageString .= ' '.$pgCnt.' ';
$pgCnt++;
}
elseif ($i < $totalRows)
{
$pageString .= ' '.$pgCnt.' ';
$pgCnt++;
};
$page++;
};
}
$nextPosition = $startPos + $rowsPerPage;
if($totalRows == '')
{
$pageString .= 'Next ';
}
elseif($startPos < $totalRows )
{
If ( $nextPosition < $totalRows )
{
$pageString .= 'Next ';
}
}
if($startPos < $totalRows )
{
$next10Position = $startPos + $tenthPages ;
If($next10Position < $totalRows )
{
$next10Position = $startPos + $tenthPages ;
$pageString .= ' >>';
}
}
return $pageString;
}
?>