深喉咙SHLCMS 分页显示结果美化教程

  好久没有写博客了,最近在做一个网站,因为前台页面人家已经写好。我只是认真嵌入,所以要凭据要求把页面做得跟设计一样,深喉咙的分页太丑了,所以举办了一些美化,结果和代码如下,和各人分享一下:

  结果:

  首先修改"\inc\class.pager.php",将

public function Show($url,$style=0)

  改为

public function Show($url,$style=2)

  然后将"elseif($style==2)"后花括号中的内容改为:

elseif($style==2)
{
$tpageNum=8;
$tempStr ='<div class=http://down.chinaz.com/try/201204/"page"><table align=http://down.chinaz.com/try/201204/"center" cellpadding=http://down.chinaz.com/try/201204/"0" cellspacing=http://down.chinaz.com/try/201204/"0" border=http://down.chinaz.com/try/201204/"0"><tr>';
$tempStr .= $this->prvNo()<1?'':'';
if($this->cPage<$tpageNum/2)
{
$tstart=1;
$tend=$tpageNum+1;
}
else
{
$tstart=$this->cPage-$tpageNum/2;
$tend=$this->cPage+$tpageNum/2;
}
$tstart=$tstart<1?1:$tstart;
$tend=$tend>$this->totalPageNo?$this->totalPageNo:$tend;
$tempStr .='<td>共'.$this->totalPageNo.'页</td>';
$tempStr .= $this->prvNo()<1?'':'<td class=http://down.chinaz.com/try/201204/"pagespace"><a href=http://down.chinaz.com/try/201204/"'.$this->rootpath.$url.$this->prvNo().$this->anchor.'"><button class=http://down.chinaz.com/try/201204/"btn1">前一页</button></a></td>';
$tempStr .='<td class=http://down.chinaz.com/try/201204/"pagenum"> ';
for($i=$tstart;$i<$tend+1;$i++)
{
$tempStr .= $this->cPage==$i?"<a href=\"#\" class=\"currentpage\"> $i </a>":' <a href=http://down.chinaz.com/try/201204/"'.$this->rootpath.$url.$i.'">'.$i.$this->anchor.'</a> ';
}
$tempStr .='</td>';
$tempStr .= $this->nextNo()>$this->totalPageNo?'':'<td class=http://down.chinaz.com/try/201204/"pagespace"><a href=http://down.chinaz.com/try/201204/"'.$url.$this->nextNo().$this->anchor.'"><button class=http://down.chinaz.com/try/201204/"btn1">下一页</button></a></td>';
$tempStr .= $this->nextNo()>$this->totalPageNo?'':'<td class=http://down.chinaz.com/try/201204/"pagespace"><button class=http://down.chinaz.com/try/201204/"btn1"> <a href=http://down.chinaz.com/try/201204/"'.$this->rootpath.$url.$this->lastNo().$this->anchor.'">最后页</a></button></td>';
$tempStr .= '<td>跳转至<select name=http://down.chinaz.com/try/201204/"pagerMenu" onChange=http://down.chinaz.com/try/201204/"location=\''.$this->rootpath.$url.'\'+this.options[this.selectedIndex].value+\''.$this->anchor.'\'";>';
for($i=1;$i<$this->totalPageNo+1;$i++)
{
$tempStr .= '<option value=http://down.chinaz.com/try/201204/"'.$i.'http://down.chinaz.com/try/201204/"';
$tempStr .= $i==$this->cPage?' selected=http://down.chinaz.com/try/201204/"selected"':'';
$tempStr .= '>'.$i.'</option>';
}
$tempStr .= '</select>页</td>';
$tempStr .=http://down.chinaz.com/try/201204/"</td></tr></table></div> ";
}

  最后在样式表中增加:

.pagenum a{ padding:0px 6px; *padding:2px 6px; _padding:2px 6px; line-height:21px; margin:0px 2px; background:#fff; border:1px solid #e4e4e4;}
.page button{ font-size:12px;}
.btn1{ width: 56px; height:21px; line-height:21px; padding-left:6px; text-align:left; border:none; background:url(../images/btnbg.jpg) left -104px no-repeat;}
.btn2{ width:60px; height:22px; line-height:22px; text-align:center; border:none; background:url(../images/btnbg.jpg) -56px -104px no-repeat;}
.pagenum a.currentpage{ background:#007dfe; border:1px solid #007dfe; color:#fff; font-weight:bold;}
.pagespace{ padding-left:3px;}
.page .pagespace input{ width:30px;}
.page{ position:relative; top:15px}

  btnbg.jpg在这里

深喉咙SHLCMS 分页显示功效美化教程

  但愿各人多给意见和发起,让我们一同进步。

  原文地点:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10109.html