織夢dedecms v5.1升級sp1后不顯示上一篇、下一篇問題的解決方法
方法很簡單,也是最懶的方法,把關(guān)鍵之處恢復(fù)為升級之前的,需要修改兩處。
第一處:
修改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();
}
}
腳本之家注釋: 其實(shí)主要是修改了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");
現(xiàn)在的
$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']." ".$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']." ".$this->PreNext['next'];
}</p> <p> return $rs;
}
改好的文件覆蓋上傳即可。
當(dāng)然這里也是修改的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 ";
因?yàn)榭赡馨姹静煌?,不建議直接全部復(fù)制,只需要替換下sql語句即可。要不容易出現(xiàn)錯誤。
相關(guān)文章
織夢dedecms安全漏洞include/common.inc.php漏洞解決方法
據(jù)悉DEDECMS的全局變量初始化存在漏洞,可以任意覆蓋任意全局變量,下面是具體的解決方法,需要的朋友可以參考下2021-05-13織夢DEDECMS建立模型、簡單分表、索引優(yōu)化操作方法
最近因?yàn)槭褂玫膁ede系統(tǒng)考慮后期數(shù)據(jù)量大的問題,所以提前將dedecms優(yōu)化一下,應(yīng)對后期數(shù)據(jù)量大導(dǎo)致后臺卡等問題,這里為大家分享一下,主要是思路對于新版本的dedecms需要2021-05-12DedeCMS大數(shù)據(jù)負(fù)載性能優(yōu)化方案(簡單幾招讓你提速N倍)
今天我們分享一下DedeCMS數(shù)據(jù)負(fù)載性能優(yōu)化的方法,因?yàn)槟壳?0w條記錄,導(dǎo)致站點(diǎn)后臺查詢慢,生成HTML也很吃力,經(jīng)過下面的優(yōu)化確實(shí)可以提升不少2021-05-12mysql織夢索引優(yōu)化之MySQL Order By索引優(yōu)化
最近基于mysql數(shù)據(jù)庫的織夢系統(tǒng)查詢與生成靜態(tài)頁面比較慢,所以想優(yōu)化一下索引試試能不能提高一下執(zhí)行效率下面是具體的實(shí)現(xiàn)步驟,需要的朋友可以參考一下2021-05-12織夢dedecms頁面空白后開啟錯誤信息提示功能方便調(diào)試錯誤
織夢后臺空白、織夢后臺左側(cè)空白等相關(guān)問題,如果沒有報錯提示信息,不顯示任何內(nèi)容,對新手來說摸不著頭腦,無從下手,開啟織夢錯誤信息提示錯誤調(diào)試設(shè)置,讓程序告訴我們2021-05-12
織夢DedeCMS 分表實(shí)現(xiàn)一個欄目對應(yīng)一個表(圖)
最近考慮用dedecms做個大數(shù)據(jù)量的網(wǎng)站,為什么用dedecms呢因?yàn)檫@個系統(tǒng)特別好用,但負(fù)載是軟肋,很多功能只能自己動手實(shí)現(xiàn)了,下面就為大家分享一下具體的方法2021-05-12- 這篇文章主要介紹了加固版織夢CMS整站源碼通用安裝教程,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-03-17
織夢DEDECMS robots優(yōu)化設(shè)置的具體方法
這篇文章主要介紹了織夢DEDECMS robots優(yōu)化設(shè)置的具體方法,DEDECMS自帶的robots.txt文件設(shè)置很簡單,并不能完全滿足網(wǎng)站的優(yōu)化要求,需要的朋友可以參考下本篇方法2020-12-02Dedecms網(wǎng)站Title標(biāo)簽SEO優(yōu)化方法
這篇文章主要介紹了Dedecms網(wǎng)站Title標(biāo)簽SEO優(yōu)化方法,主要涉及到如何實(shí)現(xiàn)"三級欄目_二級欄目_一級欄目_網(wǎng)站名稱"的問題,需要的朋友可以參考下小編的方法2020-12-02dedecms文章關(guān)鍵字(自動內(nèi)鏈)php5.5以上版本urf-8失效的解決方法
這篇文章主要為大家詳細(xì)介紹了dedecms文章關(guān)鍵字(自動內(nèi)鏈)php5.5以上版本urf-8失效的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下,有需要的朋友可以收藏2020-11-18


