三,替换函数function GetArcList()为全新的
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') { global $cfg_list_son; $typeid=$this->TypeID; if($row=='') $row = 10; if($limitstart=='') $limitstart = 0; if($titlelen=='') $titlelen = 100; if($infolen=='') $infolen = 250; if($imgwidth=='') $imgwidth = 120; if($imgheight=='') $imgheight = 120; if($listtype=='') $listtype = 'all'; if($orderWay=='') $orderWay = 'desc'; if($orderby=='') { $orderby='default'; } else { $orderby=strtolower($orderby); } $tablewidth = str_replace('%','',$tablewidth); if($tablewidth=='') $tablewidth=100; if($col=='') $col=1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth.'%'; $colWidth = $colWidth.'%'; $innertext = trim($innertext); if($innertext=='') { $innertext = GetSysTemplets('list_fulllist.htm'); } //排序方式 $ordersql = ''; if($orderby=="senddate" || $orderby=="id") { $ordersql=" order by arc.id $orderWay"; } else if($orderby=="hot" || $orderby=="click") { $ordersql = " order by arc.click $orderWay"; } else if($orderby=="lastpost") { $ordersql = " order by arc.lastpost $orderWay"; }else if($orderby=="weight") { $ordersql = " order by arc.weight $orderWay"; } else { $ordersql=" order by arc.sortrank $orderWay"; } //新增综合排序:默认 最热 最新 价高 价低 $addtable = $this->ChannelUnit->ChannelInfos['addtable']; if($_GET['myorder']=='默认'){ $orderby='sortrank'; $ordersql = " order by arc.sortrank $orderWay"; }elseif($_GET['myorder']=='hot'){ $orderby='hot'; $ordersql = " order by arc.click $orderWay"; } elseif($_GET['myorder']=='new'){ $orderby='id'; $ordersql = " order by arc.id $orderWay"; } elseif($_GET['myorder']=='price_high'){ $orderby='price_high'; $ordersql = " order by ".$addtable.".price ".$orderWay; } elseif($_GET['myorder']=='price_low'){ $orderby='price_low'; $ordersql = " order by ".$addtable.".price asc"; } elseif($_GET['myorder']=='mian_high'){ $orderby='mian_high'; $ordersql = " order by ".$addtable.".mian ".$orderWay; } elseif($_GET['myorder']=='mian_low'){ $orderby='mian_low'; $ordersql = " order by ".$addtable.".mian asc"; } else{ $ordersql=" order by arc.id $orderWay"; } //多条件查询新增,获得附加表的相关信息/ ////获得一个单列的文档列表继续 if($addtable!="") { $addJoin = " left join `$addtable` on arc.id = ".$addtable.'.aid '; $addField = ''; $fields = explode(',',$this->ChannelUnit->ChannelInfos['listfields']); foreach($fields as $k=>$v) { $nfields[$v] = $k; } if(is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) { foreach($this->ChannelUnit->ChannelFields as $k=>$arr) { if(isset($nfields[$k])) { if(!empty($arr['rename'])) { $addField .= ','.$addtable.'.'.$k.' as '.$arr['rename']; } else { $addField .= ','.$addtable.'.'.$k; } } } } if (isset($_REQUEST['tid'])){ $myget=$_GET; unset($myget['myorder']);//删除一个字段 foreach($myget as $key => $value) { $mywhere=" AND $addtable.".snail_filter($key)." = '".snail_filter(urldecode($value))."'"; } $filtersql .= ($key!="tid" && $key!="TotalResult" && $key!="PageNo") ? $mywhere : ''; } } else { $addField = ''; $addJoin = ''; } //print_r($addField);exit;//取出所有自定义字段 织梦6久阁模板网 //print_r($addJoin);exit;//left join `dede_addonarticle` on arc.id = dede_addonarticle.aid //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) if(ereg('hot|click|lastpost|weight',$orderby)) { $query = "Select arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addField from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出ID,然后按ID查询(速度非常快) else { $t1 = ExecTime(); $ids = array(); $query = "SELECT id FROM `dede_arctiny` arc $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row "; //print_r($query);exit;//SELECT id FROM `dede_arctiny` arc left join `dede_addonarticle` on arc.id = dede_addonarticle.aid WHERE arc.arcrank > -1 And ( arc.typeid = '1' OR CONCAT(',', arc.typeid2, ',') like '%,1,%' ) AND dede_addonarticle.mystate = '即将开始' AND dede_addonarticle.mytype = '投资返现' order by arc.id desc LIMIT 0,16 $this->dsql->SetQuery($query); $this->dsql->Execute(); //die(mysql_error()); while($arr=$this->dsql->GetArray()) { $ids[] = $arr['id']; } //print_r($ids);exit; $idstr = join(',',$ids); //print_r($idstr);exit;//13,12,11,10,9,5,4 文章id串 if($idstr=='') { return ''; } else { $query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addField from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id $addJoin where arc.id in($idstr) $ordersql "; } $t2 = ExecTime(); //echo $t2-$t1; } $this->dsql->SetQuery($query); //print_r($query);exit; //die(mysql_error()); $this->dsql->Execute('al'); $t2 = ExecTime(); //echo $t2-$t1;exit; $artlist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; for($i=0;$i<$row;$i++) //print_r($row);exit;调用条数20 { if($col>1) { $artlist .= "<div>\r\n"; } for($j=0;$j<$col;$j++) { if($row = $this->dsql->GetArray("al")) //print_r($row);exit; { $GLOBALS['autoindex']++; $ids[$row['id']] = $row['id']; //处理一些特殊字段 $row['infos'] = cn_substr($row['description'],$infolen); $row['id'] = $row['id']; if($row['corank'] > 0 && $row['arcrank']==0) { $row['arcrank'] = $row['corank']; } $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'], $row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); if($row['litpic'] == '-' || $row['litpic'] == '') { $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif'; } if(!eregi("^",$row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; } $row['picname'] = $row['litpic']; $row['stime'] = GetDateMK($row['pubdate']); $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>"; $row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>"; $row['fulltitle'] = $row['title']; $row['title'] = cn_substr($row['title'],$titlelen); if($row['color']!='') { $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>"; } if(ereg('c',$row['flag'])) { $row['title'] = "".$row['title'].""; } $row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>"; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; //编译附加表里的数据 foreach($row as $k=>$v) { $row[strtolower($k)] = $v; } foreach($this->ChannelUnit->ChannelFields as $k=>$arr) { if(isset($row[$k])) { $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); } } if(is_array($this->dtp2->CTags)) { foreach($this->dtp2->CTags as $k=>$ctag) { //print_r($this->dtp2->CTags);exit;所有字段名 if($ctag->GetName()=='array') { //传递整个数组,在runphp模式中有特殊作用 $this->dtp2->Assign($k,$row); } else { if(isset($row[$ctag->GetName()])) { $this->dtp2->Assign($k,$row[$ctag->GetName()]); } else { $this->dtp2->Assign($k,''); } } } } if($row['myendtime']!=''){ if($row['myendtime']<time()){//已结束的活动 $artlist2 .= $this->dtp2->GetResult(); }else{ $artlist1 .= $this->dtp2->GetResult(); } $artlist=$artlist1.$artlist2; }else{ $artlist .= $this->dtp2->GetResult(); } //$i2=$i2+1; //print_r($i2); }//if hasRow //exit; }//Loop Col //print_r($col);exit; if($col>1) { $i += $col - 1; $artlist .= " </div>\r\n"; } $row2[] = $row; }//Loop Line //print_r($row2);exit; $t3 = ExecTime(); //echo ($t3-$t2); $this->dsql->FreeResult('al'); //die(mysql_error()); return $artlist; }织梦列表页点击按价格按评分按更新按点击排序进行筛选方法(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/4bb072002a666e682767dd3909e641c2.html