您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP分页库

2024/4/13 19:42:29发布22次查看
total       = $total ;
                 $this -> onepage     = $onepage ;
                 $this -> total_page = @ ceil ( $total / $onepage ) ;
if ( empty ( $pageid ))
                 {
                         $this -> pageid = 1 ;
                         $this -> offset          = 0 ;       
                 }
                 else
                 {
                         $this -> pageid = $pageid ;
                         $this -> offset     = ( $pageid - 1 ) * $onepage ;
                 }
$linkarr = explode ( &pageid= , $_server [ ' query_string ' ]) ;
                 $linkft   = $linkarr [ 0 ] ;               
                 $self = str_replace ( index.php , , $_server [ ' php_self ' ]) ;
                 if ( empty ( $linkft ))
                         $this -> linkhead = $self . ? . $formlink ;
                 else
                         $this -> linkhead = $self . ? . $linkft . $formlink ;
         }
function pre_page ( $char = '' , $others = '' )
         {
                 $linkhead   = $this -> linkhead ;
                 $pageid = $this -> pageid ;
if ( $pageid > 1 )
                 {
                         $pre_page = $pageid - 1 ;
                         if ( $others )
                                 return $char ;
                         else
                                 return $char ;
                 }
                 else
                         return '' ;
         }
function next_page ( $char = '' , $others = '' )
         {
                 $linkhead    = $this -> linkhead ;
                 $total_page = $this -> total_page ;
                 $pageid   = $this -> pageid ;
                 if ( $pageid                  {
                         $next_page = $pageid + 1 ;
                         if ( $others )
                                 return $char ;
                         else
                                 return $char ;
                 }
                 else
                         return '' ;
         }
function num_bar ( $num = '' , $color = '' , $others = '' , $left = '' , $right = '' )
         {
                 $num        = ( empty ( $num )) ? 10 : $num ;
                 $this -> num = $num ;
                 $mid        = floor ( $num / 2 ) ;
                 $last       = $num - 1 ;
                 $pageid = $this -> pageid ;
                 $totalpage = $this -> total_page ;
                 $linkhead   = $this -> linkhead ;
                 $left       = ( empty ( $left )) ? [ : $left ;
                 $right      = ( empty ( $right )) ? ] : $right ;
                 $color      = ( empty ( $color )) ? #ff0000 : $color ;
                 $minpage    = (( $pageid - $mid )                  $maxpage    = $minpage + $last ;
                 if ( $maxpage > $totalpage )
                 {
                         $maxpage = $totalpage ;
                         $minpage = $maxpage - $last ;
                         $minpage = ( $minpage                  }
for ( $i = $minpage ; $i                  {
                         $char = $left . $i . $right ;
                         if ( $i == $pageid )
                                 $linkchar = $char ;
                         else
                                 $others ? $linkchar = . $char . : $linkchar = . $char . ;
                         $linkbar   = $linkbar . $linkchar ;
                 }
return $linkbar ;
         }
function pre_group ( $char = '' , $others = '' )
         {        
                 $pageid    = $this -> pageid ;
                 $linkhead     = $this -> linkhead ;
                 $num              = $this -> num ;
                 $mid          = floor ( $num / 2 ) ;
                 $minpage      = (( $pageid - $mid )                  $pgpageid = ( $minpage > $num ) ? $minpage - $mid : 1 ;
if ( $pageid != $minpage )
                         $others ? $linkherf = . $char . : $linkherf = . $char . ;
                 else
                         $linkherf = $char ;
                 return $linkherf ;
         }
function next_group ( $char = '' , $others = '' )
         {
                 $pageid = $this -> pageid ;
                 $linkhead   = $this -> linkhead ;
                 $totalpage = $this -> total_page ;
                 $num            = $this -> num ;
                 $mid        = floor ( $num / 2 ) ;
                 $last       = $num ;
                 $minpage    = (( $pageid - $mid )                  $maxpage    = $minpage + $last ;
                 if ( $maxpage > $totalpage )
                 {
                         $maxpage = $totalpage ;
                         $minpage = $maxpage - $last ;
                         $minpage = ( $minpage                  }
$ngpageid = ( $totalpage > $maxpage + $last ) ? $maxpage + $mid : $totalpage ;
                 if ( $pageid == $maxpage || $maxpage == 0 )
                         $linkherf = $char ;
                 else
                         $others ? $linkherf = . $char . : $linkherf = . $char . ;
return $linkherf ;
         }
function whole_num_bar ( $num = '' , $color = '' , $others = '' )
     {        
                 $num_bar = $this -> num_bar ( $num , $color , $others ) ;
         $pre_group   = $this -> pre_group ( ' |          $pre_page    = $this -> pre_page ( '          $next_page   = $this -> next_page ( ' > ' , $others ) ;
         $next_group = $this -> next_group ( ' >| ' , $others ) ;
return   $pre_group . $pre_page . $num_bar . $next_page . $next_group ;
     }
}
?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product