dedecms列表页上一页下一页翻页单独调用的方法

  发布时间:2014-12-16 10:15:03   作者:佚名   我要评论
这篇文章主要为大家介绍了dedecms列表页上一页下一页翻页单独调用的方法,涉及针对列表页底层代码部分的修改,对于dedecms二次开发有一定的借鉴价值,需要的朋友可以参考下
(福利推荐:【腾讯云】服务器最新限时优惠活动,云服务器1核2G仅99元/年、2核4G仅768元/3年,立即抢购>>>:9i0i.cn/qcloud

(福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

本文实例讲述了dedecms列表页上一页下一页翻页单独调用的方法。分享给大家供大家参考。具体实现方法如下:

在列表页单独调用上一页和下一页,以及首页,简单搞了一下,仅作上下翻页,主页类似,可自行添加。

在模板中以

复制代码
代码如下:
{dede:pagelist listitem="up"/}
{dede:pagelist listitem="down"/}

来调用。

修改办法如下:

在include\arc.listview.class.php

找到:

复制代码
代码如下:
/获得上一页和主页的链接
if($this->PageNo != 1)
{
$prepage.="<</b>li>上一页\r\n";
$indexpage="<</b>li>首页\r\n";

$uppage.="<</b>a href='".str_replace("{page}",$prepagenum,$tnamerule)."'>上一页\r\n";
}
else
{
$indexpage="<</b>li>首页\r\n";
$uppage.="<</b>a>没有了<</b>/a>\r\n";
} </p> <p>//下一页,未页的链接
if($this->PageNo!=$totalpage && $totalpage>1)
{
$nextpage.="<</b>li><</b>a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页\r\n";
$endpage="<</b>li><</b>a href='".str_replace("{page}",$totalpage,$tnamerule)."'>末页\r\n"; </p> <p>$downpage.="<</b>a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页\r\n";
}
else
{
$endpage="<</b>li>末页\r\n";
$downpage.="<</b>a>没有了\r\n";
}

然后:

复制代码
代码如下:
$plist = '';
if(preg_match('/up/i', $listitem)) $plist .= $uppage;
if(preg_match('/down/i', $listitem)) $plist .= $downpage;
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;

希望本文所述对大家的dedecms建站有所帮助。

相关文章

最新评论

?


http://www.vxiaotou.com