织梦DEDECMS标签TAG列表页有分页页码,但没数据的解决方法

最近检查TAG标签时发现,有的TAG标签打开后,列表里面没有数据,但下面分页代码却还在,原来TAG标签关联过很多已经删除的文档,在TAG标签列表页就会出现有页码分页没有数据的情况,这是因为织梦的TAG标签列表核心文件不严谨引起的,我们可以让关联的TAG标签所属的已经删除的文档在TAG表中删除掉就能解决空数据列表问题。

解决方法:

打开 /include/arc.taglist.class.php 搜索

 //更新Tag信息

大概在 137行左右,把它上面的这3行代码

$cquery = "SELECT COUNT(*) AS dd FROM `#@__taglist` WHERE tid = '{$this->TagInfos['id']}' AND arcrank >-1 ";
$row = $this->dsql->GetOne($cquery);
$this->TotalResult = $row['dd'];

修改为:

$this->dsql->SetQuery("SELECT aid FROM `#@__taglist` WHERE tid = '{$this->TagInfos['id']}' AND arcrank>-1 ");
$this->dsql->Execute();
while($row=$this->dsql->GetArray())
{
	$atrow = $this->dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id='{$row['aid']}' AND arcrank>-1");
	if(!is_array($atrow))
	{
		$this->dsql->ExecuteNoneQuery("DELETE FROM `#@__taglist` WHERE aid='{$row['aid']}' ");
		continue;
	}
	$idlists .= ($idlists=='' ? $row['aid'] : ','.$row['aid']);
}
if($idlists!=='') $this->TotalResult = $row['dd'] = count(explode(',',$idlists));

解决。

 

THE END