如果你的TAG標(biāo)簽關(guān)聯(lián)過很多已經(jīng)刪除的文檔,那么在TAG標(biāo)簽列表頁就會(huì)出現(xiàn)有頁碼分頁沒有數(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ù)列表問題
打開 /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));
圖解