建站技術網專注分享網站建設技術,網站建設教程,真正幫你學會做網站技術,輕松解決網站建設過程中遇到的常見問題,為廣大站長服務。 網站地圖 | 收藏本站 | 訂閱
域名投資,就來找米網,認準網址:www.zhaomi.cc 專業仿站,就到仿站網:www.fangzhan.org
  站內公告: ·帝國cms教程內容已更新,歡迎關注     ·建站技術網采用阿里云服務器,備案已通    
您當前的位置:建站技術網 > cms教程 > Dedecms教程

織夢dedecms v5.1升級sp1后不顯示上一篇、下一篇問題的解決方法

時間:2019-04-29 23:28:07  來源:網絡收集  整理: 建站技術網 www.txwlqq.com     點擊:0次

方法很簡單,也是最懶的方法,把關鍵之處恢復為升級之前的,需要修改兩處。

第一處:

修改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 And 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 And 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<$aid And arcrank>-1 And typeid='$typeid' order by ID desc");
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid 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();
}
}

諾心網絡注釋: 其實主要是修改了sql語句

原來的:


復制代碼
代碼如下:

$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");
$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");

現在的

復制代碼
代碼如下:

$preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-1 And typeid='$typeid' order by ID desc");
$nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And arcrank>-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)
{</p><p> $aid = $this->ArcID;
$idmax = $this->ArcID+10;
$idmin = $this->ArcID-10;
$next = " arc.ID>'$aid' And arc.ID<'$idmax' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";
$pre = " arc.ID>'$idmin' And arc.ID<'$aid' And arc.arcrank>-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))
{
$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'] = "上一篇:<a href='$mlink' target='_blank'>{$preRow['title']}</a> ";
}
else{
$this->PreNext['pre'] = "上一篇:沒有了 ";
}
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']);
$this->PreNext['next'] = "下一篇:<a href='$mlink' target='_blank'>{$nextRow['title']}</a> ";
}
else{
$this->PreNext['next'] = "下一篇:沒有了 ";
}
}</p><p> if($gtype=='pre'){
$rs = $this->PreNext['pre'];
}
else if($gtype=='next'){
$rs = $this->PreNext['next'];
}
else{
$rs = $this->PreNext['pre']." &nbsp; ".$this->PreNext['next'];
}</p><p> return $rs;
}

改為:


復制代碼
代碼如下:

//--------------------------
//獲取上一篇,下一篇鏈接
//--------------------------
function GetPreNext($gtype='')
{
$rs = "";
if(count($this->PreNext)<2)
{</p><p> $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<'$aid' And arc.arcrank>-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))
{
$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'] = "上一篇:<a href='$mlink' target='_blank'>{$preRow['title']}</a> ";
}
else{
$this->PreNext['pre'] = "上一篇:沒有了 ";
}
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']);
$this->PreNext['next'] = "下一篇:<a href='$mlink' target='_blank'>{$nextRow['title']}</a> ";
}
else{
$this->PreNext['next'] = "下一篇:沒有了 ";
}
}</p><p> if($gtype=='pre'){
$rs = $this->PreNext['pre'];
}
else if($gtype=='next'){
$rs = $this->PreNext['next'];
}
else{
$rs = $this->PreNext['pre']." &nbsp; ".$this->PreNext['next'];
}</p><p> return $rs;
}

改好的文件覆蓋上傳即可。

當然這里也是修改的sql語句


復制代碼
代碼如下:

$next = " arc.ID>'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID asc ";
$pre = " arc.ID<'$aid' And arc.arcrank>-1 And typeid='{$this->Fields['typeid']}' order by arc.ID desc ";

因為可能版本不同,不建議直接全部復制,只需要替換下sql語句即可。要不容易出現錯誤。

標簽:
文章標題:織夢dedecms v5.1升級sp1后不顯示上一篇、下一篇問題的解決方法
文章網址:http://www.txwlqq.com/cmsJiaocheng/dedecms/10381.html
上一篇:用dedecms實現拼音顯示文章標題頁文件名的方法
下一篇:DEDECMS文章地址優化方法:目錄式結構
來頂一下
返回首頁
返回首頁
相關文章
    無相關信息
推薦資訊
如何通過SEO優化排名賺錢?SEO賺錢方法
如何通過SEO優化排名賺
seo優化教程:網站seo內容優化
seo優化教程:網站seo
SEO細節:企業SEO如何快速為新站做出效果
SEO細節:企業SEO如何
電商技術將如何發展?2018年有這五個大膽預測
電商技術將如何發展?
最新文章
欄目更新
欄目熱門
成人黄色