国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

dede多條件篩選_程序功能開發

2024-04-25 20:32:00
字體:
來源:轉載
供稿:網友

這種多條件篩選構思上就是利用條件拼接sql語句,但就dedecms的功能來看,靜態頁比較難實現。建議進行二次開發,或者制作php單頁。
況且存儲你所要查詢的信息的表,應該也不是dede內置的表就能做的。
一個比較好的方式就是靜態的欄目頁,用ajax向一個php頁提交參數,得到返回值后載入到頁面中,體驗好,難度也不大。
引入 /include/common.inc.php 文件,利用dedecms的語法二次開發吧

第一步打開include文件夾下的extend.func.php文件

/*dedecms聯動篩選功能字符過濾函數*/

functionwwwcms_filter($str,$stype="inject"){

if($stype=="inject"){

$str=str_replace(array("select","insert","update","delete","alter","cas","union","into","load_file","outfile","create","join","where","like","drop","modify","rename","‘","/*","*","../","./"),array("","","","","","","","","","","","","","","","","","","","","",""),$str);

}

elseif($stype=="xss"){

$farr=array("/s+/","/<(/?)(script|META|STYLE|HTML|HEAD|BODY|STYLE|i?frame|b|strong|style|html|img|P|o:p|iframe|u|em|strike|BR|div|a|TABLE|TBODY|object|tr|td|st1:chsdate|FONT|span|MARQUEE|body|title||link|meta|?|/%)([^>]*?)>/isU","/(<[^>]*)on[a-zA-Z]+s*=([^>]*>)/isU",);

$tarr=array("","","/1/2",);

$str=preg_replace($farr,$tarr,$str);

$str=str_replace(array("<",">","‘",""",";","/*","*","../","./"),array("&lt;","&gt;","","","","","","",""),$str);

}

return$str;

}

/**

*載入自定義表單(用于發布)

*

*@accesspublic

*@paramstring$fieldset字段列表

*@paramstring$loadtype載入類型

*@returnstring

*/

functionAddFilter($channelid,$type=1,$fieldsnamef,$defaulttid,$loadtype='autofield'){

global$tid,$dsql,$id;

$tid=$defaulttid?$defaulttid:$tid;

if($id!=""){

$tidsq=$dsql->GetOne("SelecttypeidFrom`dede_archives`whereid='$id'");

$tid=$tidsq["typeid"];

}

$nofilter=(isset($_REQUEST['TotalResult'])?"&TotalResult=".$_REQUEST['TotalResult']:'').(isset($_REQUEST['PageNo'])?"&PageNo=".$_REQUEST['PageNo']:'');

$filterarr=wwwcms_filter(stripos($_SERVER['REQUEST_URI'],"list.php?tid=")?str_replace($nofilter,'',$_SERVER['REQUEST_URI']):$GLOBALS['cfg_cmsurl']."/plus/list.php?tid=".$tid);

$cInfos=$dsql->GetOne("Select*From`dede_channeltype`whereid='$channelid'");

$fieldset=$cInfos['fieldset'];

$dtp=newDedeTagParse();

$dtp->SetNameSpace('field','<','>');

$dtp->LoadSource($fieldset);

$dede_addonfields='';

if(is_array($dtp->CTags)){

foreach($dtp->CTagsas$tid=>$ctag){

$fieldsname=$fieldsnamef?explode(",",$fieldsnamef):explode(",",$ctag->GetName());

if(($loadtype!='autofield'||($loadtype=='autofield'&&$ctag->GetAtt('autofield')==1))&&in_array($ctag->GetName(),$fieldsname)){

$href1=explode($ctag->GetName().'=',$filterarr);

$href2=explode('&',$href1[1]);

$fields_value=$href2[0];

$dede_addonfields.='<divclass="scv-shaixuan"><b>'.$ctag->GetAtt('itemname').':</b>';

switch($type){

case1:

$dede_addonfields.=(preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm)?'<atitle="全部"href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'">全部</a>':'<span>全部</span>').'&nbsp;';

$addonfields_items=explode(",",$ctag->GetAtt('default'));

for($i=0;$i<count($addonfields_items);$i++){

$href=stripos($filterarr,$ctag->GetName().'=')?str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr):$filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]);//echo$href;

$dede_addonfields.=($fields_value!=urlencode($addonfields_items[$i])?'<atitle="'.$addonfields_items[$i].'"href="'.$href.'">'.$addonfields_items[$i].'</a>':'<span>'.$addonfields_items[$i].'</span>')."&nbsp;";

}

$dede_addonfields.='</div>';

break;

case2:

$dede_addonfields.='<selectname="filter"'.$ctag->GetName().'onchange="window.location=this.options[this.selectedIndex].value">

'.'<optionvalue="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'">全部</option>';

$addonfields_items=explode(",",$ctag->GetAtt('default'));

for($i=0;$i<count($addonfields_items);$i++){

$href=stripos($filterarr,$ctag->GetName().'=')?str_replace("=".$fields_value,"=".urlencode($addonfields_items[$i]),$filterarr):$filterarr.'&'.$ctag->GetName().'='.urlencode($addonfields_items[$i]);

$dede_addonfields.='<optionvalue="'.$href.'"'.($fields_value==urlencode($addonfields_items[$i])?'selected="selected"':"").'>'.$addonfields_items[$i].'</option>';

}

$dede_addonfields.='</select><br/>';

break;

}

}

}

}

echo$dede_addonfields;

}

//聯動篩選Over

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 石泉县| 甘南县| 壤塘县| 探索| 凤山县| 龙里县| 丹东市| 达州市| 花莲县| 宜宾市| 海门市| 老河口市| 平利县| 南昌县| 岳西县| 吴忠市| 科技| 淮阳县| 江永县| 平遥县| 巩义市| 凤冈县| 饶河县| 广宗县| 石柱| 镇康县| 大理市| 鄂伦春自治旗| 大关县| 饶阳县| 招远市| 益阳市| 嘉荫县| 滦平县| 凌海市| 黄梅县| 镇远县| 集贤县| 岑溪市| 恩施市| 抚宁县|