首页 > php框架 > php google 风格分页代码

php google 风格分页代码

php  google 风格分页代码
public function showCtrlPanel_g($halfPer = 5) {
  
  $re = <div class="pageMore">
   <ul>
    <li><span>.$this->lineCount.条</span></li>
    <li><span>.$this->currentPage./.$this->pageCount.页</span></li>;
  if($this->currentPage-$halfPer >1){
   $re .= <li><a href=".$this->fileName.pageno=1"><span>1</span></a></li>;
   if($this->currentPage-$halfPer*2 >1){
    $re .= <li><a href=".$this->fileName.pageno=.($this->currentPage-$halfPer*2)."><span>...</span></a></li>;
   }else{
    $re .= <li><a href=".$this->fileName.pageno=1"><span>...</span></a></li>;
   }
  }
  for ( $i = $this->currentPage - $halfPer,$i > 1 || $i = 1 , $j = $this->currentPage + $halfPer, $j < $this->pageCount || $j = $this->pageCount;$i <= $j ;$i++ )
  {
   $re .= $i ==  $this->currentPage
    ? <li class="linkOn"><a href=".$this->fileName.pageno=.$i."><span>.$i.</span></a></li>." "
    : <li><a href=".$this->fileName.pageno=.$i."><span>.$i.</span></a></li>." ";
  }
  if($this->currentPage+$halfPer < $this->pageCount){
   if($this->currentPage+$halfPer*2 < $this->pageCount){
    $re .= <li><a href=".$this->fileName.pageno=.($this->currentPage+$halfPer*2)."><span>...</span></a></li>;
   }else{
    $re .= <li><a href=".$this->fileName.pageno=.$this->pageCount."><span>...</span></a></li>;
   }
   $re .= <li><a href=".$this->fileName.pageno=.$this->pageCount."><span>.$this->pageCount.</span></a></li>;
  }
    
  $re .=  
   </ul>
  </div>;
  return $re;
 }


本文地址:http://www.phprm.com/frame/php1004967.html

转载随意,但请附上文章地址:-)

标签:none

发表留言