第一次分享,让大家踩踩 @charset utf-8;*{padding:0;margin:0;}.page { font-size: 14px; text-align:center}.page ul{list-style-type:none;display:table;margin-left:auto;margin-right:auto}.page ul li{min-width:20px;padding:5px;margin-left:3px;border:1px solid #ccc;text-align:center;float:left;*float:none;*display:inline;*zoom:1;}.page .select{font-weight:bold;color:#000;font-size:14px;background-color:#f5f5f5;}.page li a{text-decoration:none;color:#333}.page .gray{color:#808080}pagesize = $pagesize; $this->pagecount = $pagecount; $this->currentpage = $currentpage; $this->pageurl = $pageurl; $this->totalpage = ceil($this->pagecount / $this->pagesize); } function showpage(){ $pagelink = ; $pagelink .= ; //判断是否为第一页 if($this->currentpage==1){ $pagelink .= 最前页; }else{ $pagelink .= pageurl.p=1\>最前页; } if($this->currentpage > 1 && $this->totalpage > 1){ $prepage = $this->currentpage -1; $pagelink .= pageurl.p=.$prepage.\>上一页; }else{ $pagelink .= 上一页; } //判断页总数 if($this->totalpage $frompage = 1; $topage = $this->totalpage; }else{ if($this->currentpage $frompage = 1; $topage = 11; } else if($this->currentpage > 6 && $this->totalpage - 6 > $this->currentpage){ $frompage = $this->currentpage - 5; $topage = $this->currentpage + 5; }else{ $frompage = $this->totalpage - 11; $topage = $this->totalpage; } } for($i=$frompage;$i if($i==$this->currentpage){ $pagelink .= $i; }else{ $pagelink .= pageurl.p=$i\>$i; } } //最后页面判断 if($this->currentpage totalpage){ $nextpage = $this->currentpage + 1; $pagelink .= pageurl.p=.$nextpage.\>下一页; }else{ $pagelink .= 下一页; } if($this->currentpage==$this->totalpage){ $pagelink .= 最后页; }else{ $pagelink .= pageurl.p=$this->totalpage\>最后页; } $pagelink .=; $pagelink .=; $pagelink .=
; return $pagelink; } }?>
复制代码