织梦dedecms v5.1升级sp1后不显示上一篇、下一篇问题的解决方法

织梦dedecms v5.1升级sp1后不显示上一篇、下一篇问题的解决方法,第1张

织梦dedecmsv5.1升级sp1后不显示上一篇、下一篇问题的解决方法

本文主要介绍Dreamweaverdedecmsv5.1升级sp1后无法显示上一篇和下一篇帖子的解决方法,有需要的朋友可以参考一下,但主要是不明白为什么官方加了一个id限制。

方法很简单,也是最懒的方法。要将关键点恢复到升级前的状态,需要进行两项修改。

第一名:

修改dede/inc/inc_档案_functions.php

最初:


复制代码如下:
/更新下一篇文章
if($CFG_up_prenext=='y'&&;!empty($typeid))
{
$preRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和id>。($aid+10)。"和arcrank>-1且typeid='$typeid'orderbyIDdesc");
$nextRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和id>。($aid-10)。"和arcrank>-1且typeid='$typeid'orderbyIDASC");
if(is_array($preRow)){
$arc=newArchives($preRow['ID']);
$arc->;makehtml();
}
if(is_array($nextRow)){
$arc=newArchives($nextRow['ID']);
$arc->;makehtml();
}
}

替换为:


复制代码如下:
/更新下一篇文章
if($CFG_up_prenext=='y'&&;!empty($typeid))
{
$preRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和arcrank>-1且typeid='$typeid'orderbyIDdesc");
$nextRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和arcrank>-1且typeid='$typeid'orderbyIDASC");
if(is_array($preRow)){
$arc=newArchives($preRow['ID']);
$arc->;makehtml();
}
if(is_array($nextRow)){
$arc=newArchives($nextRow['ID']);
$arc->;makehtml();
}
}

注意:其实我们主要是修改了sql语句。

原件:


复制代码如下:
$prerew=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和id>。($aid+10)。"和arcrank>-1且typeid='$typeid'orderbyIDdesc");
$nextRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和id>。($aid-10)。"和arcrank>-1且typeid='$typeid'orderbyIDASC");

当前的

复制代码如下:
$prerow=$arc-->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和arcrank>-1且typeid='$typeid'orderbyIDdesc");
$nextRow=$arc->;dsql->;getone("SelectIDFrom`{$arc->;MainTable}`其中ID<$aid和arcrank>-1且typeid='$typeid'orderbyIDASC");

就是把和id>:”..($aid+10)。”和id>:"..($aid-10)。”已被删除。为什么id不能大于10?列多了肯定不行。


第二名:

修改包含/inc_archives_view.php

最初:


复制代码如下:
///-
//获取上一个,链接下一个
/-。
if(count($this->;PreNext)<;2)
{<;/p>; <;p>$aid=$this->;ArcID
$idmax=$this->;ArcID+10;
$idmin=$this->;ArcID-10;
$next="arc。ID>$aid和arc。ID<$idmax'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDASC";
$pre="arc。ID>$idmin'和arc。ID<$aid'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDdesc”;
$query="Selectarc。ID,arc.title,arc.shorttitle,
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,
t.moresite,t.siteurl
from`{$this->;MainTable}`arcleftjoindede_arctypetonarc.typeid=t.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['site
$this->;pre['pre']="Previous:;;
}
else{
$this->;pre['pre']="Previous:Nomore";
}
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
$this->;Pre['next']="下一个:;;
}
else{
$this->;Pre['下一个']="下一个:没了";
}
}<;/p>; <;p>if($gtype=='pre'){
$RS=$this->;PreNext['pre'];
}
elseif($gtype=='next'){
$RS=$this->;PreNext['next'];
}
else{
$RS=$this->;PreNext['pre']。“&nbsp”。$this->;PreNext['next'];
}<;/p>; <;p>返回$rs
}

替换为:


复制代码如下:
///-
//获取上一个,链接下一个
/-。
if(count($this->;PreNext)<;2)
{<;/p>; <;p>$aid=$this->;ArcID
$idmax=$this->;ArcID+10;
$idmin=$this->;ArcID-10;
$next="arc。ID>$aid'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDASC";
$pre="arc。ID<$aid'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDdesc”;
$query="Selectarc。ID,arc.title,arc.shorttitle,
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,
t.moresite,t.siteurl
from`{$this->;MainTable}`arcleftjoindede_arctypetonarc.typeid=t.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['site
$this->;pre['pre']="Previous:;;
}
else{
$this->;pre['pre']="Previous:Nomore";
}
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
$this->;Pre['next']="下一个:;;
}
else{
$this->;Pre['下一个']="下一个:没了";
}
}<;/p>; <;p>if($gtype=='pre'){
$RS=$this->;PreNext['pre'];
}
elseif($gtype=='next'){
$RS=$this->;PreNext['next'];
}
else{
$RS=$this->;PreNext['pre']。“&nbsp”。$this->;PreNext['next'];
}<;/p>; <;p>返回$rs
}

修改后的文件可以被覆盖和上传。

当然,这也是修改后的sql语句。


复制代码如下:
$next="arc.id>;$aid'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDASC";
$pre="arc。ID<$aid'和arc.arcrank>-1和typeid='{$this->;字段['typeid']}'按弧线排序。IDdesc”;

因为版本可能不一样,所以不建议直接全部复制,只需替换sql语句即可。否则容易出错。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/773286.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存