织梦58

织梦dedecms5.7上一篇下一篇分开调用教程

相关案例演示

<div style="text-align: left">↑{dede:preurl/}</div>

<div style="text-align: left">↓{dede:nexturl/}</div>

改法:打开includeinc_archives_view.php

找到

//--------------------------

//获取上一篇,下一篇链接

//--------------------------

function GetPreNext()

{

$rs = "";

$aid = $this->ArcID;

$next = " dede_archives.ID>'$aid' order by dede_archives.ID asc ";

$pre = " dede_archives.ID<'$aid' order by dede_archives.ID desc ";

$query = "Select dede_archives.ID,dede_archives.title,

dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,

dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,

dede_arctype.moresite,dede_arctype.siteurl 

from dede_archives left join dede_arctype on dede_archives.typeid=dede_arctype.ID

where ";

$nextRow = $this->dsql->GetOne($query.$next);

$preRow = $this->dsql->GetOne($query.$pre);

if(is_array($preRow)){

$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);

$rs .= "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";

}

else{

$rs .= "上一篇:没有了 ";

}

if(is_array($nextRow)){

$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);

$rs .= " 下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";

}

else{

$rs .= " 下一篇:没有了 ";

}

return $rs;

}

改为:

//--------------------------

//获取上一篇,下一篇链接

//--------------------------

function GetPreNext($pn=1)

{

$rs = "";

$aid = $this->ArcID;

$typeid = $this->Fields['typeid'];

$next = " dede_archives.ID>'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID asc ";

$pre = " dede_archives.ID<'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID desc ";

$query = "Select dede_archives.ID,dede_archives.title,

dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,

dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,dede_arctype.moresite,dede_arctype.siteurl 

from dede_archives left join dede_arctype on dede_archives.typeid=dede_arctype.ID

where ";

if($pn == 0){

$preRow = $this->dsql->GetOne($query.$pre);

if(is_array($preRow)){

$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);

$prs .= "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";

}

else{

$prs .= "上一篇:没有了 ";

}

return $prs;

}

else{

$nextRow = $this->dsql->GetOne($query.$next);

if(is_array($nextRow)){

$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);

$nrs .= "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";

}

else{

$nrs .= "下一篇:没有了 ";

}

return $nrs;

}

}

找到:

//上下篇链接

else if($tagname=="prenext"){

$this->dtp->Assign($tagid,$this->GetPreNext());

}

改为:

//上下篇链接

else if($tagname=="preurl"){

$this->dtp->Assign($tagid,$this->GetPreNext(0));

}

else if($tagname=="nexturl"){

$this->dtp->Assign($tagid,$this->GetPreNext());


有问题可以加入织梦技术QQ群一起交流学习

本站vip会员 请加入织梦58 VIP②群 PS:加入时备注用户名或昵称

普通注册会员或访客 请加入织梦58 技术交流②群

作者:DEDE58.CC时间:2020-05-24
首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程
QQ在线咨询
双语模板 营销型模板 手机模板 响应式模板