如果你的TAG標(biāo)簽關(guān)聯(lián)過(guò)很多已經(jīng)刪除的文檔,那么在TAG標(biāo)簽列表頁(yè)就會(huì)出現(xiàn)有頁(yè)碼分頁(yè)沒(méi)有數(shù)據(jù)的情況,如下圖所示
這是因?yàn)榭棄?mèng)的TAG標(biāo)簽列表核心文件不嚴(yán)謹(jǐn)引起的,我們可以讓關(guān)聯(lián)的TAG標(biāo)簽所屬的已經(jīng)刪除的文檔在TAG表中刪除掉就能解決空數(shù)據(jù)列表問(wèn)題
打開(kāi) /include/arc.taglist.class.php 找到,大概在 129 至 131 行,這3行代碼
$cquery = "SELECT COUNT(*) AS dd FROM `dede_taglist` WHERE tid = '{$this->TagInfos['id']}' AND arcrank >-1 ";
$row = $this->dsql->GetOne($cquery);
$this->TotalResult = $row['dd'];
改成
$this->dsql->SetQuery("SELECT aid FROM `dede_taglist` WHERE tid = '{$this->TagInfos['id']}' AND arcrank>-1 ");
$this->dsql->Execute();
while($row=$this->dsql->GetArray())
{
$atrow = $this->dsql->GetOne("SELECT id FROM `dede_arctiny` WHERE id='{$row['aid']}' AND arcrank>-1");
if(!is_array($atrow))
{
$this->dsql->ExecuteNoneQuery("DELETE FROM `dede_taglist` WHERE aid='{$row['aid']}' ");
continue;
}
$idlists .= ($idlists=='' ? $row['aid'] : ','.$row['aid']);
}
if($idlists!=='') $this->TotalResult = $row['dd'] = count(explode(',',$idlists));
圖解