织梦dedecms v5.1升级sp1后不显示上一篇、下一篇问题的解决方法_dedecms_CMS教程_脚本之家

方法很简单,也是最懒的方法,把关键之处恢复为升级之前的,需要修改两处。Tjc迪尔课堂自学网-|第二课堂|--(官网)

第一处:Tjc迪尔课堂自学网-|第二课堂|--(官网)

修改dede/inc/inc_archives_functions.phpTjc迪尔课堂自学网-|第二课堂|--(官网)

原为:Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
//更新上下篇文章Tjc迪尔课堂自学网-|第二课堂|--(官网)
if($cfg_up_prenext=='Y' && !empty($typeid))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid+10)." And arcrank>-1 And typeid='$typeid' order by ID desc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid-10)." And arcrank>-1 And typeid='$typeid' order by ID asc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($preRow)){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc = new Archives($preRow['ID']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc->MakeHtml();Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($nextRow)){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc = new Archives($nextRow['ID']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc->MakeHtml();Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

改为:Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
//更新上下篇文章Tjc迪尔课堂自学网-|第二课堂|--(官网)
if($cfg_up_prenext=='Y' && !empty($typeid))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-1 And typeid='$typeid' order by ID desc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-1 And typeid='$typeid' order by ID asc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($preRow)){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc = new Archives($preRow['ID']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc->MakeHtml();Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($nextRow)){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc = new Archives($nextRow['ID']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$arc->MakeHtml();Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

迪尔课堂注释: 其实主要是修改了sql语句Tjc迪尔课堂自学网-|第二课堂|--(官网)

原来的:Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid+10)." And arcrank>-1 And typeid='$typeid' order by ID desc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid-10)." And arcrank>-1 And typeid='$typeid' order by ID asc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

现在的Tjc迪尔课堂自学网-|第二课堂|--(官网)

复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-1 And typeid='$typeid' order by ID desc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-1 And typeid='$typeid' order by ID asc");Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

就是将And ID>".($aid+10)." 与And ID>".($aid-10)." 去掉了,为什么id不能大于10呢。如果对于栏目比较多的,肯定不行Tjc迪尔课堂自学网-|第二课堂|--(官网)

Tjc迪尔课堂自学网-|第二课堂|--(官网)
第二处:Tjc迪尔课堂自学网-|第二课堂|--(官网)

修改include/inc_archives_view.phpTjc迪尔课堂自学网-|第二课堂|--(官网)

原为:Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
//--------------------------Tjc迪尔课堂自学网-|第二课堂|--(官网)
//获取上一篇,下一篇链接Tjc迪尔课堂自学网-|第二课堂|--(官网)
//--------------------------Tjc迪尔课堂自学网-|第二课堂|--(官网)
function GetPreNext($gtype='')Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = "";Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(count($this->PreNext)<2)Tjc迪尔课堂自学网-|第二课堂|--(官网)
{</p><p> $aid = $this->ArcID;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$idmax = $this->ArcID+10;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$idmin = $this->ArcID-10;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$next = " arc.ID>'$aid' And arc.ID<'$idmax' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$pre = " arc.ID>'$idmin' And arc.ID<'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$query = "Select arc.ID,arc.title,arc.shorttitle,Tjc迪尔课堂自学网-|第二课堂|--(官网)
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,Tjc迪尔课堂自学网-|第二课堂|--(官网)
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,Tjc迪尔课堂自学网-|第二课堂|--(官网)
t.moresite,t.siteurlTjc迪尔课堂自学网-|第二课堂|--(官网)
from `{$this->MainTable}` arc left join dede_arctype t on arc.typeid=t.IDTjc迪尔课堂自学网-|第二课堂|--(官网)
where ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $this->dsql->GetOne($query.$next);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $this->dsql->GetOne($query.$pre);Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($preRow))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['pre'] = "上一篇:<a href='$mlink' target='_blank'>{$preRow['title']}</a> ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['pre'] = "上一篇:没有了 ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($nextRow))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['next'] = "下一篇:<a href='$mlink' target='_blank'>{$nextRow['title']}</a> ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['next'] = "下一篇:没有了 ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
}</p><p> if($gtype=='pre'){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['pre'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else if($gtype=='next'){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['next'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['pre']." &nbsp; ".$this->PreNext['next'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}</p><p> return $rs;Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

改为:Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
//--------------------------Tjc迪尔课堂自学网-|第二课堂|--(官网)
//获取上一篇,下一篇链接Tjc迪尔课堂自学网-|第二课堂|--(官网)
//--------------------------Tjc迪尔课堂自学网-|第二课堂|--(官网)
function GetPreNext($gtype='')Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = "";Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(count($this->PreNext)<2)Tjc迪尔课堂自学网-|第二课堂|--(官网)
{</p><p> $aid = $this->ArcID;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$idmax = $this->ArcID+10;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$idmin = $this->ArcID-10;Tjc迪尔课堂自学网-|第二课堂|--(官网)
$next = " arc.ID>'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$pre = " arc.ID<'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$query = "Select arc.ID,arc.title,arc.shorttitle,Tjc迪尔课堂自学网-|第二课堂|--(官网)
arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,Tjc迪尔课堂自学网-|第二课堂|--(官网)
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,Tjc迪尔课堂自学网-|第二课堂|--(官网)
t.moresite,t.siteurlTjc迪尔课堂自学网-|第二课堂|--(官网)
from `{$this->MainTable}` arc left join dede_arctype t on arc.typeid=t.IDTjc迪尔课堂自学网-|第二课堂|--(官网)
where ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$nextRow = $this->dsql->GetOne($query.$next);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$preRow = $this->dsql->GetOne($query.$pre);Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($preRow))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['pre'] = "上一篇:<a href='$mlink' target='_blank'>{$preRow['title']}</a> ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['pre'] = "上一篇:没有了 ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
if(is_array($nextRow))Tjc迪尔课堂自学网-|第二课堂|--(官网)
{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['next'] = "下一篇:<a href='$mlink' target='_blank'>{$nextRow['title']}</a> ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$this->PreNext['next'] = "下一篇:没有了 ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
}</p><p> if($gtype=='pre'){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['pre'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else if($gtype=='next'){Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['next'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
else{Tjc迪尔课堂自学网-|第二课堂|--(官网)
$rs = $this->PreNext['pre']." &nbsp; ".$this->PreNext['next'];Tjc迪尔课堂自学网-|第二课堂|--(官网)
}</p><p> return $rs;Tjc迪尔课堂自学网-|第二课堂|--(官网)
}Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

改好的文件覆盖上传即可。Tjc迪尔课堂自学网-|第二课堂|--(官网)

当然这里也是修改的sql语句Tjc迪尔课堂自学网-|第二课堂|--(官网)


复制代码
代码如下:
Tjc迪尔课堂自学网-|第二课堂|--(官网)
$next = " arc.ID>'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
$pre = " arc.ID<'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";Tjc迪尔课堂自学网-|第二课堂|--(官网)
Tjc迪尔课堂自学网-|第二课堂|--(官网)

因为可能版本不同,不建议直接全部复制,只需要替换下sql语句即可。要不容易出现错误。Tjc迪尔课堂自学网-|第二课堂|--(官网)

扫一扫手机访问