DedeCMS列表页支持键盘翻上、下页功能会让用户体验翻页十分方便,SEO博客、图片站采用这样的功能将为网站带来更多的PV。开发上、下翻页功能并不复杂,结合DedeCMS,织梦58SEO整合了这个功能,并修正首页和第一页分页内容重复问题,以适合SEO优化。
支持键盘左右键翻页JS部分
<script type="text/javascript" src="jquery.js"></script><!--引入jquery-->
<script type="text/javascript"> $(document).ready(function(){
var prevpage=$("#pre").attr("href");
var nextpage=$("#next").attr("href");
$("body").keydown(function(event){
if(event.keyCode==37 && prevpage!=undefined) location=prevpage;
if(event.keyCode==39 && nextpage!=undefined) location=nextpage;
});
});
</script>
|
? ? ? ?控制的列表上、下页<a>标签如下
<a id="pre" href="list_1_1">上一页</a>
<a id="next" href="list_1_3">下一页</a>
|
? ? ? ?但是DedeCMS默认的上、下页格式并没有单独调用的标签。下面是实现方法:
静态分页单独调用上下页链接
? ? ? ?打开/include/arc.listview.class.php,修改静态分页列表部分(动态分页感兴趣的童鞋自己研究一下吧),找到
return $plist;
}
/**
* 获取动态的分页列表
|
? ? ? ?前面加上
$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;
|
? ? ? ?这样修改,按照自己的实际需求,可以单独调用首页链接、上一页链接、页数、下一页链接、尾页链接、分页信息等。调用方法
{dede:pagelist listitem="pre"/}
{dede:pagelist listitem="next"}
{dede:pagelist listitem="index"}
{dede:pagelist listitem="option"}
{dede:pagelist listitem="pageno"}
{dede:pagelist listitem="info"}
|
? ? ? ?调用出来的HTML样式如下:
<p class="pages">
<ul>
<li><a href="list_3_1.html">上一页</li>
<li class="thisclass"><a href="list_3_2.html">2</a></li>
<li><a href="list_3_3.html">3</a></li>
<li><a href="list_3_2.html">下一页</a></li>
<li><a href="list_3_3.html">末页</a></li>
<li><span class="pageinfo">共 <strong>3</strong>页<strong>11</strong>条</span></li>
</ul>
</p>
|
? ? ? ?实现键盘翻页需要绑定静态分页的上一页和下一页<a>标签的ID,默认是没有ID,打开include/arc.listview.class.php,找到
? ? ? ?继续往下,找到
$prepage.="<li><a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页</a></li>rn";
|
? ? ? ?修改为
$prepage.="<li><a id='pre' href='".str_replace("{page}",$tnamerule)."'>上一页</a></li>rn";
|
? ? ? ?找到
$nextpage.="<li><a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页</a></li>rn";
|
? ? ? ?修改为
$nextpage.="<li><a id='next' href='".str_replace("{page}",$tnamerule)."'>下一页</a></li>rn";
|
上一篇:DedeCMS短消息与发送到指定邮箱功能开发
下一篇:DedeCMS织梦实现会员签到加积分互动功能
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|