织梦翻页样式修改

时间:2016-12-21 10:34 / 来源:未知 / 作者:酱油 / 点击:

因为修改模板的需要,翻页样式各种各样,大家可以随意修改,本站仅举例方便大家查改修改文件而已,具体样式,自己控制。

效果图

源代码

样式表 CSS

.page{float:left;position:relative;left:50%;clear:both;padding:5px 0 5px 0;text-align:center;font-family:Tahoma; margin-top:10px;}
.page .turn{position:relative;float:left;left:-50%;}
.page a,.page .disabled,.page .current,.page .pageinfo{color:#403F3D;padding:0 11px 0 0;height:32px;display:block;float:left;line-height:32px;line-height:34px\9;_line-height:32px;text-decoration:none;margin:0 2px;background:url(bga.png) no-repeat right -150px;}
.page a:hover{color:#333;font-weight:normal;background-position:right -230px;text-decoration:none;}
.page .current{font-weight:bold;background-position:right -190px;color:#666;}
.page .pageinfo{color:#666;background-position:right -330px;margin-right:4px;}
.page u{width:3px;display:block;height:32px;float:left;padding-right:9px;*padding-right:9px;_padding-right:5px;overflow:hidden;background:url(bga.png) no-repeat 0 -150px;}
.page .current u{background-position:0 -190px;}
.page a:hover u{background-position:0 -230px;}
.page .pageinfo u{background-position:0 -330px;}
.page .disabled{color:#999;}

修改代码,不一一详细介绍,大家具体对照,取样与DEDE5.7SP1版本 原文件代码

/**
* 获取静态的分页列表
*
* @access public
* @param string $list_len 列表宽度
* @param string $list_len 列表样式
* @return string
*/
function GetPageListST($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage = $nextpage = '';
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len=='' || preg_match("/[^0-9]/", $list_len))
{
$list_len=3;
}
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0)
{
 
return "<li><span class=\"pageinfo\">共 <strong>1</strong>页<strong>".$this->TotalResult."</strong>条记录</span></li>\r\n";
}
if($this->TotalResult == 0)
{
return "<li><span class=\"pageinfo\">共 <strong>0</strong>页<strong>".$this->TotalResult."</strong>条记录</span></li>\r\n";
}
$purl = $this->GetCurUrl();
$maininfo = "<li><span class=\"pageinfo\">共 <strong>{$totalpage}</strong>页<strong>".$this->TotalResult."</strong>条</span></li>\r\n";
$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule = preg_replace("/^(.*)\//", '', $tnamerule);
 
//获得上一页和主页的链接
if($this->PageNo != 1)
{
$prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a></li>\r\n";
$indexpage="<li><a href='".str_replace("{page}",1,$tnamerule)."'>首页</a></li>\r\n";
}
else
{
$indexpage="<li>首页</li>\r\n";
}
 
//下一页,未页的链接
if($this->PageNo!=$totalpage && $totalpage>1)
{
$nextpage.="<li><a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页</a></li>\r\n";
$endpage="<li><a href='".str_replace("{page}",$totalpage,$tnamerule)."'>末页</a></li>\r\n";
}
else
{
$endpage="<li>末页</li>\r\n";
}
 
//option链接
$optionlist = '';
 
$optionlen = strlen($totalpage);
$optionlen = $optionlen*12 + 18;
if($optionlen < 36) $optionlen = 36;
if($optionlen > 100) $optionlen = 100;
$optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
for($mjj=1;$mjj<=$totalpage;$mjj++)
{
if($mjj==$this->PageNo)
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";
}
else
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";
}
}
$optionlist .= "</select></li>\r\n";
 
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list)
{
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage)
{
$total_list=$totalpage;
}
}
else
{
$j=1;
if($total_list>$totalpage)
{
$total_list=$totalpage;
}
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->PageNo)
{
$listdd.= "<li class=\"thisclass\">$j</li>\r\n";
}
else
{
$listdd.="<li><a href='".str_replace("{page}",$j,$tnamerule)."'>".$j."</a></li>\r\n";
}
}
$plist = '';
if(preg_match('/index/i', $listitem)) $plist .= $indexpage;
if(preg_match('/pre/i', $listitem)) $plist .= $prepage;
if(preg_match('/pageno/i', $listitem)) $plist .= $listdd;
if(preg_match('/next/i', $listitem)) $plist .= $nextpage;
if(preg_match('/end/i', $listitem)) $plist .= $endpage;
if(preg_match('/option/i', $listitem)) $plist .= $optionlist;
if(preg_match('/info/i', $listitem)) $plist .= $maininfo;
 
return $plist;
}

修改后

/**
* 获取静态的分页列表
*
* @access public
* @param string $list_len 列表宽度
* @param string $list_len 列表样式
* @return string
*/
function GetPageListST($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage = $nextpage = '';
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len=='' || preg_match("/[^0-9]/", $list_len))
{
$list_len=3;
}
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0)
{
 
return "<span class=\"pageinfo\"><u></u>共1页".$this->TotalResult."条记录</span>\r\n";
}
if($this->TotalResult == 0)
{
return "<span class=\"pageinfo\"><u></u>共0页".$this->TotalResult."条记录</span>\r\n";
}
$purl = $this->GetCurUrl();
$maininfo = "<span class=\"pageinfo\"><u></u>共{$totalpage}页".$this->TotalResult."条</span>\r\n";
$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule = preg_replace("/^(.*)\//", '', $tnamerule);
$typedir= ereg_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$this->Fields['typedir']);
$baseUrl = $GLOBALS['cfg_basehost'].ereg_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$this->Fields['baseUrl']);
//获得上一页和主页的链接
if($this->PageNo != 1)
{
if($prepagenum==1)
{
$prepage.="<a href=\"".$baseUrl.$typedir."/\" title=\"上一页\"><u></u>上一页</a>\r\n";
}
else
{
$prepage.="<a href=\"".$baseUrl.$typedir."/".str_replace("{page}",$prepagenum,$tnamerule)."\" title=\"上一页\"><u></u>上一页</a>\r\n";
}
$indexpage="<a href=\"".$baseUrl.$typedir."/\"><u></u>首页</a>\r\n";
}
else
{
$indexpage="<span class=\"disabled\"><u></u>首页</span>\r\n";
}
 
//下一页,未页的链接
if($this->PageNo!=$totalpage && $totalpage>1)
{
$nextpage.="<a href=\"".$baseUrl.$typedir."/".str_replace("{page}",$nextpagenum,$tnamerule)."\" title=\"下一页\"><u></u>下一页</a>\r\n";
$endpage="<a href=\"".$baseUrl.$typedir."/".str_replace("{page}",$totalpage,$tnamerule)."\" ><u></u>末页</a>\r\n";
}
else
{
$endpage="<span class=\"disabled\"><u></u>末页</span>\r\n";
}
//option链接
$optionlist = '';
 
$optionlen = strlen($totalpage);
$optionlen = $optionlen*12 + 18;
if($optionlen < 36) $optionlen = 36;
if($optionlen > 100) $optionlen = 100;
$optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
for($mjj=1;$mjj<=$totalpage;$mjj++)
{
if($mjj==$this->PageNo)
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";
}
else
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";
}
}
$optionlist .= "</select></li>\r\n";
 
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->PageNo >= $total_list)
{
$j = $this->PageNo-$list_len;
$total_list = $this->PageNo+$list_len;
if($total_list>$totalpage)
{
$total_list=$totalpage;
}
}
else
{
$j=1;
if($total_list>$totalpage)
{
$total_list=$totalpage;
}
}
for($j;$j<=$total_list;$j++)
{
if($j==$this->PageNo)
{
if($j==1)
{
$listdd.="<span class=\"current\"><u></u>$j</span>\r\n";
}
else
{
$listdd.="<span class=\"current\"><u></u>$j</span>\r\n";
}
}
else
{
$listdd.="<a href=\"".$baseUrl.$typedir."/".str_replace("{page}",$j,$tnamerule)."\"><u></u>".$j."</a>\r\n";
}
}
$plist = '';
if(preg_match('/index/i', $listitem)) $plist .= $indexpage;
if(preg_match('/pre/i', $listitem)) $plist .= $prepage;
if(preg_match('/pageno/i', $listitem)) $plist .= $listdd;
if(preg_match('/next/i', $listitem)) $plist .= $nextpage;
if(preg_match('/end/i', $listitem)) $plist .= $endpage;
if(preg_match('/option/i', $listitem)) $plist .= $optionlist;
if(preg_match('/info/i', $listitem)) $plist .= $maininfo;
 
return $plist;
}

目前涉及到的常见需要翻页的页面还包含搜索结果和tags聚合标签翻页,涉及到的文件分别是include/arc.searchview.class.php和include/arc.taglist.class.php,方法和以上一样。

猜你喜欢

推荐栏目

DEDECMS
DEDECMS

DEDE使用经验和技巧

WordPress
Wordpress

WP使用经验和技巧

Zblog
Zblog

Zblog使用经验和技巧

CSS
CSS

CSS使用经验和技巧

网络资料
网络资料

转载实用网络资料

按键伤人
按键伤人

转载乱七八糟的网络资源

我是酱油
我是酱油

随笔札记 记录生活点滴

本站推荐

百度站内搜索

专业博客主机