织梦列表页list标签调用支持flag属性方法

织梦列表页list标签支持flag属性方法:(注:红色标记部分就是修改处)

1、打开include/arc.listview.class.php

2、找到 var $remoteDir;  替换为  var $flag;

3、找到下方代码并注释

//        if($this->TotalResult==-1)
//        {
//            $cquery = "SELECT COUNT(*) AS dd FROM `dede_arctiny` arc WHERE ".$this->addSql;
//            $row = $this->dsql->GetOne($cquery);
//            if(is_array($row))
//            {
//                $this->TotalResult = $row['dd'];
//            }
//            else
//            {
//                $this->TotalResult = 0;
//            }
//        }

4、找到 $this->TotalPage = ceil($this->TotalResult/$this->PageSize); 在前面添加如下代码: 

/* flag */
if($this->TotalResult==-1)
{
    foreach($this->dtp->CTags as $tagid=>$ctag)
    {
        $flag = $ctag->GetAtt('flag');
        if($flag!='') {
            $this->addSql .=   " and (arc.flag like '%{$flag}%') ";
        }
    }
    $cquery = "SELECT COUNT(*) AS dd FROM `dede_archives` arc WHERE ".$this->addSql;
    $row = $this->dsql->GetOne($cquery);
    if(is_array($row))
    {
        $this->TotalResult = $row['dd'];
    }
    else
    {
        $this->TotalResult = 0;
    }
}
/* flag end */

5、找到 $ctag->GetAtt("orderway"); 替换为 $ctag->GetAtt("flag");

6、找到函数 GetArcList 在参数中添加 $flag=''

function GetArcList(
    $limitstart=0,
    $row=10,
    $col=1,
    $titlelen=30,
    $infolen=250,
    $imgwidth=120,
    $imgheight=90,
    $listtype="all",
    $orderby="default",
    $innertext="",
    $tablewidth="100",
    $ismake=1,
    $orderWay='desc',
    $flag=''
)

7、在"//排序方式"上面添加 :

//添加flag标签

$whereFlag = "";

if($flag!='') {

    $whereFlag = " and arc.flag like '%{$flag}%' ";

}

8、找到if(preg_match('/hot|click|weight|lastpost/', $orderby)) 修改成  if(preg_match('/hot|click|lastpost|weight|flag/', $orderby))

9、标签调用:

  {dede:list flag='c' pagesize ='3'}

      {/dede:list}

  接下来{dede:list}标签就支持了flag属性的调用了。

 list标签支持flag属性效果图:

list标签支持flag属性效果图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值