-
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 {
- if ( $PageNo == $pgCnt )
- {
- $pageString .= ' '.$pgCnt.' ';
- $pgCnt++;
- }
- elseif ($i {
- $pageString .= ' '.$pgCnt.' ';
- $pgCnt++;
- };
-
- $page++;
- };
- }
-
- $nextPosition = $startPos + $rowsPerPage;
-
- if($totalRows == '')
- {
- $pageString .= 'Next ';
- }
- elseif($startPos {
- If ( $nextPosition {
- $pageString .= 'Next ';
- }
- }
-
- if($startPos {
- $next10Position = $startPos + $tenthPages ;
-
- If($next10Position {
- $next10Position = $startPos + $tenthPages ;
- $pageString .= ' >>';
- }
- }
- return $pageString;
- }
- ?>
复制代码
|