织梦翻页样式修改
因为修改模板的需要,翻页样式各种各样,大家可以随意修改,本站仅举例方便大家查改修改文件而已,具体样式,自己控制。
效果图
源代码
样式表 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,方法和以上一样。
推荐栏目
本站推荐
- 修改DEDE链接中的单引号为双引号
- DEDECMS启用绝对路径后远程缩略图存BUG
- 织梦dedecms自由列表的"不使用目录默认
- dedecms把文章批量设为未审核的办法
- 织梦调用父级栏目链接和名称
- 织梦data文件夹移动到程序上一层目录
- 优化增加搜索栏目功能后的搜索结果
- 织梦同级栏目指定文章调用实现相关文章教
- 织梦获取顶级栏目\当前栏目\上级栏目的相
- 织梦dedecms栏目添加自定义字段,增加栏
- 织梦DedeCMS自增函数[field:global name=
- dedecms织梦上传图片 缩略图路径统一
- 新增DEDE栏目页,无法更新,无权限
- 修改织梦摘要长度字数限制
- DEDECMS后台批量替换数据安全码不显示
- 织梦DEDECMS网站标签Tag静态化,生成静态
- 去掉FCK编辑器复制粘贴产生的<p>&a
- 完美解决FCK编辑器上传图片自动带DIV标签
- 去掉FCK编辑器每一段之前的空格 
- 织梦登录后台显示空白
百度站内搜索
Copyright © 2007-2014 海鬼 保留所有权利.
无心无力无时间来进行无用的备案
Theme by 海鬼 坚持不一定胜利 也许你在南辕北辙!