在用dedecms做二次开发的时候发现会员的文章列表页下面的文章分页一直显示的都是 共 0 页/0条记录 ,才发现是程序出了问题。跟踪代码才发现问题的所在是写的查询总数的正则是错误的,不知道是故意的还是忘记了在测试的时候忘记改过来...
要修改的程序文件为include/arc.memberlistview.class.php
138行源代码为:
if($this->totalResult==0)
{
//$this->isQuery = true;
//$this->dsql->Execute('mbdl',$this->sourceSql);
//$this->totalResult = $this->dsql->GetTotalRow('mbdl');
$countQuery = preg_replace("/select[ \r\n\t](.*)[ \r\n\t]from/i","Select count(*) as dd From",$this->sourceSql);
$row = $this->dsql->GetOne($countQuery);
$row['dd'] = empty($row['dd']) ? 0 : $row['dd'];
$this->totalResult = $row['dd'];
$this->sourceSql .= " limit 0,".$this->pageSize;
}
if($this->totalResult==0)
{
$this->isQuery = true;
$this->dsql->Execute('mbdl',$this->sourceSql);
$this->totalResult = $this->dsql->GetTotalRow('mbdl');
$this->sourceSql .= " limit 0,".$this->pageSize;
}