DeDecms上下文章 实现让DeDecms的上下文章链接限制在当前栏目内

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

DeDecms上下文章 实现让DeDecms的上下文章链接限制在当前栏目内

  2021-03-17 我要评论
想了解实现让DeDecms的上下文章链接限制在当前栏目内的相关内容吗,在本文为您仔细讲解DeDecms上下文章的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:DeDecms,上下文章,下面大家一起来学习吧。
修改方法:
找到include/inc_archives_view.php中的function GetPreNext()函数,修改为:
复制代码 代码如下:

//--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext()
{
$rs = "";
$aid = $this->ArcID;
$rid = $this->Fields['typeid'];
$next = " #@__archives.ID>'$aid' and #@__archives.typeID='$rid' order by #@__archives.ID asc ";
$pre = " #@__archives.ID<'$aid' and #@__archives.typeID='$rid' order by #@__archives.ID desc ";
//$next = " #@__archives.ID>'$aid' order by #@__archives.ID asc ";
//$pre = " #@__archives.ID<'$aid' order by #@__archives.ID desc ";
$query = "Select #@__archives.ID,#@__archives.title,
#@__archives.typeid,#@__archives.ismake,#@__archives.senddate,#@__archives.arcrank,#@__archives.money,
#@__arctype.typedir,#@__arctype.typename,#@__arctype.namerule,#@__arctype.namerule2,#@__arctype.ispart,
#@__arctype.moresite,#@__arctype.siteurl 
from #@__archives left join #@__arctype on #@__archives.typeid=#@__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;
}

如果你不会修改,还可以下载修改后的:inc_archives_view.php。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们