首页 >

织梦DedeCMS v5.1升级sp1后不显示上一篇、下一篇问题的搞定方式

方法很简单,也是最懒的方法,把关键之处恢复为升级以前的,需要修改两处。

织梦DedeCMS v5.1升级sp1后不显示上一篇、下一篇问题的搞定方式

第一处:

修改dede/inc/inc_archives_functions.php

原为:


代码如下:

//更新上下篇文章if($cfg_up_prenext=='Y' && !empty($typeid)){$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID".($aid+10)." And arcrank>-1 And typeid='$typeid' order by ID desc");$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID".($aid-10)." And arcrank>-1 And typeid='$typeid' order by ID asc");if(is_array($preRow)){$arc = new Archives($preRow['ID']);$arc->MakeHtml();}if(is_array($nextRow)){$arc = new Archives($nextRow['ID']);$arc->MakeHtml();}}

改为:


代码如下:

//更新上下篇文章if($cfg_up_prenext=='Y' && !empty($typeid)){$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID-1 And typeid='$typeid' order by ID desc");$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID-1 And typeid='$typeid' order by ID asc");if(is_array($preRow)){$arc = new Archives($preRow['ID']);$arc->MakeHtml();}if(is_array($nextRow)){$arc = new Archives($nextRow['ID']);$arc->MakeHtml();}}

网管之家注释: 其实主要是修改了sql语句

原来的:


代码如下:

$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID".($aid+10)." And arcrank>-1 And typeid='$typeid' order by ID desc");$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID".($aid-10)." And arcrank>-1 And typeid='$typeid' order by ID asc");

现在的
代码如下:

$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID-1 And typeid='$typeid' order by ID desc");$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID-1 And typeid='$typeid' order by ID asc");

就是将And ID>”.($aid+10).” 与And ID>”.($aid-10).” 去掉了,为什么id不能大于10呢。如果对于栏目比较多的,肯定不行


第二处:

修改include/inc_archives_view.php

原为:


代码如下:
//————————–
//获取上一篇,下一篇链接
//————————–
function GetPreNext($gtype=”)
{
$rs = “”;
if(count($this->PreNext)<2)
{

$aid = $this->ArcID;
$idmax = $this->ArcID+10;
$idmin = $this->ArcID-10;
$next = ” arc.ID>’$aid’ And arc.ID-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID asc “;
$pre = ” arc.ID>’$idmin’ And arc.ID-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID desc “;
$query = “Select arc.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}` arc left join dede_arctype t on arc.typeid=t.ID
where “;
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow))
{
https://www.liuzhongwei.com/a/dedejq/$mlink = GetFileUrl($preRow[‘ID’],$preRow[‘typeid’],$preRow[‘senddate’],$preRow[‘title’],$preRow[‘ismake’],$preRow[‘arcrank’],$preRow[‘namerule’],$preRow[‘typedir’],$preRow[‘money’],true,$preRow[‘siteurl’]);
$this->PreNext[‘pre’] = “上一篇:{$preRow[‘title’]} “;
}
else{
$this->PreNext[‘pre’] = “上一篇:没有了 “;
}
if(is_array($nextRow))
{
https://www.liuzhongwei.com/a/dedejq/$mlink = GetFileUrl($nextRow[‘ID’],$nextRow[‘typeid’],$nextRow[‘senddate’],$nextRow[‘title’],$nextRow[‘ismake’],$nextRow[‘arcrank’],$nextRow[‘namerule’],$nextRow[‘typedir’],$nextRow[‘money’],true,$nextRow[‘siteurl’]);
$this->PreNext[‘next’] = “下一篇:{$nextRow[‘title’]} “;
}
else{
$this->PreNext[‘next’] = “下一篇:没有了 “;
}
}

if($gtype==’pre’){
$rs = $this->PreNext[‘pre’];
}
else if($gtype==’next’){
$rs = $this->PreNext[‘next’];
}
else{
$rs = $this->PreNext[‘pre’].” “.$this->PreNext[‘next’];
}

return $rs;
}

改为:


代码如下:
//————————–
//获取上一篇,下一篇链接
//————————–
function GetPreNext($gtype=”)
{
$rs = “”;
if(count($this->PreNext)<2)
{

$aid = $this->ArcID;
$idmax = $this->ArcID+10;
$idmin = $this->ArcID-10;
$next = ” arc.ID>’$aid’ And arc.arcrank>-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID asc “;
$pre = ” arc.ID-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID desc “;
$query = “Select arc.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}` arc left join dede_arctype t on arc.typeid=t.ID
where “;
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow))
{
https://www.liuzhongwei.com/a/dedejq/$mlink = GetFileUrl($preRow[‘ID’],$preRow[‘typeid’],$preRow[‘senddate’],$preRow[‘title’],$preRow[‘ismake’],$preRow[‘arcrank’],$preRow[‘namerule’],$preRow[‘typedir’],$preRow[‘money’],true,$preRow[‘siteurl’]);
$this->PreNext[‘pre’] = “上一篇:{$preRow[‘title’]} “;
}
else{
$this->PreNext[‘pre’] = “上一篇:没有了 “;
}
if(is_array($nextRow))
{
https://www.liuzhongwei.com/a/dedejq/$mlink = GetFileUrl($nextRow[‘ID’],$nextRow[‘typeid’],$nextRow[‘senddate’],$nextRow[‘title’],$nextRow[‘ismake’],$nextRow[‘arcrank’],$nextRow[‘namerule’],$nextRow[‘typedir’],$nextRow[‘money’],true,$nextRow[‘siteurl’]);
$this->PreNext[‘next’] = “下一篇:{$nextRow[‘title’]} “;
}
else{
$this->PreNext[‘next’] = “下一篇:没有了 “;
}
}

if($gtype==’pre’){
$rs = $this->PreNext[‘pre’];
}
else if($gtype==’next’){
$rs = $this->PreNext[‘next’];
}
else{
$rs = $this->PreNext[‘pre’].” “.$this->PreNext[‘next’];
}

return $rs;
}

改好的文件覆盖上传即可。

当然这里也是修改的sql语句


代码如下:
$next = ” arc.ID>’$aid’ And arc.arcrank>-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID asc “;
$pre = ” arc.ID-1 And typeid='{$this->Fields[‘typeid’]}’ order by arc.ID desc “;

因为可能版本不同,不建议直接全部复制,只需要替换下sql语句即可。要不容易出现错误。



织梦DedeCMS v5.1升级sp1后不显示上一篇、下一篇问题的搞定方式
  • 织梦DedeCMS图片上传文件路径修改
  • 织梦DedeCMS图片上传文件路径修改 | 织梦DedeCMS图片上传文件路径修改 ...

    织梦DedeCMS v5.1升级sp1后不显示上一篇、下一篇问题的搞定方式
  • 织梦DedeCMS织梦DedeCMS缩略图完美优化
  • 织梦DedeCMS织梦DedeCMS缩略图完美优化 | 织梦DedeCMS织梦DedeCMS缩略图完美优化 ...

    织梦DedeCMS v5.1升级sp1后不显示上一篇、下一篇问题的搞定方式
  • 织梦DedeCMS三级标题优化,按“三级栏目_二级栏目_一级栏目
  • 织梦DedeCMS三级标题优化,按“三级栏目_二级栏目_一级栏目 | 织梦DedeCMS三级标题优化,按“三级栏目_二级栏目_一级栏目 ...