DEDE分页列表页自定义字段索引

0

改动文件arc.listview.class.php

45行新增

1
    var $where;

259行

1
2
3
4
5
6
7
8
9
10
11
12
            else
            {
                $this->PageSize = 20;
            }
            //ADD
            if($ctag->GetAtt("where")!="")
            {
            $this->where=explode(",",$ctag->GetAtt("where"));
            };
            //ADDEND
        }
        $this->TotalPage = ceil($this->TotalResult/$this->PageSize);

783行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//ADD
$where="";
$c_arr=array();
	if(!empty($this->where))
	{
	foreach($this->where as $v)
	{
		if($v!='' && isset($_GET[$v]))
		{
			$c_arr[]="$v='{$_GET[$v]}'";
		}
	}
	if(count($c_arr)>0)  //ADDEND
	    $where=" and ". implode(" and ",$c_arr);
}
//以上为增加
 
        //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)

804行

1
WHERE {$this->addSql} $where $ordersql LIMIT $limitstart,$row";

832行

1
WHERE arc.id in($idstr) $where $ordersql ";

列表页的标签

{dede:list pagesize='10' where='city,price'}

即在where属性中,增加需要筛选的字段列表,用逗号分割

然后访问如下地址实现筛选

/plus/list.php?tid=1&city=北京&price=3500

发表评论

您的邮箱不会公开,当您的评论有新的回复时,会通过您填写的邮箱向您发送评论内容。 必填字段 *

为何看不到我发布的评论?

正在提交, 请稍候...