织梦列表页list标签支持flag属性方法:(注:红色标记部分就是修改处)
1、打开include/arc.listview.class.php
2、找到 var $remoteDir;
替换 var $remoteDir;
var $flag;
3、找到下方代码并注释
01 |
// if ($this->TotalResult==-1) |
03 |
// $cquery = "SELECT COUNT(*) AS dd FROM `dede_arctiny` arc WHERE " .$this->addSql; |
04 |
// $row = $this->dsql->GetOne($cquery); |
07 |
// $this->TotalResult = $row[ 'dd' ]; |
11 |
// $this->TotalResult = 0; |
|
4、在253行左右找到$this->TotalPage = ceil($this->TotalResult/$this->PageSize);在前面添加如下代码:
02 |
if ($this->TotalResult==-1) |
04 |
foreach($this->dtp->CTags as $tagid=>$ctag) |
06 |
$flag = $ctag->GetAtt( 'flag' ); |
08 |
$this->addSql .= " and (arc.flag like '%{$flag}%') " ; |
11 |
$cquery = "SELECT COUNT(*) AS dd FROM `dede_archives` arc WHERE " .$this->addSql; |
12 |
$row = $this->dsql->GetOne($cquery); |
15 |
$this->TotalResult = $row[ 'dd' ]; |
19 |
$this->TotalResult = 0; |
|
5、在637行左右找到$ctag->GetAtt(“orderway”)
替换$ctag->GetAtt(“orderway”),
$ctag->GetAtt(“flag”)
6、在712行左右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=”)中添加了$flag=”
7、在745行左右也就是”//排序方式”上面添加 :
//添加flag标签
$whereFlag = “”;
if($flag!=”) {
$whereFlag = ” and arc.flag like ‘%{$flag}%’ “;
}
8、在799行左右 修改成 if(preg_match(‘/hot|click|lastpost|weight|flag/’, $orderby))
9、标签调用:
{dede:list flag=’c’ pagesize =’3′}
{/dede:list}
接下来{dede:list}标签就支持了flag属性的调用了。