购彩计划

  • <tr id='t2eLSj'><strong id='t2eLSj'></strong><small id='t2eLSj'></small><button id='t2eLSj'></button><li id='t2eLSj'><noscript id='t2eLSj'><big id='t2eLSj'></big><dt id='t2eLSj'></dt></noscript></li></tr><ol id='t2eLSj'><option id='t2eLSj'><table id='t2eLSj'><blockquote id='t2eLSj'><tbody id='t2eLSj'></tbody></blockquote></table></option></ol><u id='t2eLSj'></u><kbd id='t2eLSj'><kbd id='t2eLSj'></kbd></kbd>

    <code id='t2eLSj'><strong id='t2eLSj'></strong></code>

    <fieldset id='t2eLSj'></fieldset>
          <span id='t2eLSj'></span>

              <ins id='t2eLSj'></ins>
              <acronym id='t2eLSj'><em id='t2eLSj'></em><td id='t2eLSj'><div id='t2eLSj'></div></td></acronym><address id='t2eLSj'><big id='t2eLSj'><big id='t2eLSj'></big><legend id='t2eLSj'></legend></big></address>

              <i id='t2eLSj'><div id='t2eLSj'><ins id='t2eLSj'></ins></div></i>
              <i id='t2eLSj'></i>
            1. <dl id='t2eLSj'></dl>
              1. <blockquote id='t2eLSj'><q id='t2eLSj'><noscript id='t2eLSj'></noscript><dt id='t2eLSj'></dt></q></blockquote><noframes id='t2eLSj'><i id='t2eLSj'></i>
                加入vip [签到送金□币]
                注册 登录 QQ登录
                织梦无忧,用心做□ 好源码!7年品牌,值得信赖! 织梦无忧,个个精品,宁缺毋滥!每月购买¤不少于3000元精品源码免费分享,早开通,早享受!终身会员临时大促,只需要128元!新会员开通,直接进入会员中心--购买会员--直接开通即可。

                织梦dedecms 5.7实现联动筛选(支持多条件多级】选项)

                摘要: 很多织梦建站的站长在做产品列表页的时候,产品分类多而且都是关联的,用户不能快▼速的找到自己需要的东西,很多情况下都需要用到筛选功能,织梦后台列表页默认是没有联动筛选功能,实现这个联动筛选功能需要对织梦进行二次开发,接下来教大家如何实现这个联

                很多织梦建站的站长在做产品列表页的时候,产品分类多而且都是关联的,用户」不能快速的找到自己需要的东西,很多情况下都需要用到筛选功能,织梦后台列表页默认是没有联动筛选功能,实现这个联动筛选功能需要对织梦进行二次开发,接下来教大『家如何实现这个联动筛选功能,如下图所示:
                织梦DEDECMS5.7实现联动筛选(支持】多条件多级选项)
                注:因为织梦默认是禁止使用php标签,所以需要在后台模板引擎禁用标▼签里面解除这个标签的禁用,具体方法: 后台——系统——系统基本参数——其它选项——模板引擎禁用标签:php 将这个PHP去掉后保存就可以了!
                第一步:修改include目录下arc.listview.class.php,修改地方∩很多,下载地ㄨ址为:

                第二步:打开include目录下extend.func.php文件在底部加入以下代码:
                  

                //dedecms联动筛选功能 By
                function wwwcms_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);
                  } else if ($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 |\r\n|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;
                 }
                
                /**
                  *  载入自定义表单(用于发布)
                  *
                  * @access    public
                  * @param     string  $fieldset  字段列表
                 * @param     string  $loadtype  载入类型
                 * @return    string
                  */
                 
                 function AddFilter($channelid, $type=1, $fieldsnamef, $defaulttid, $loadtype='autofield')
                 {
                  global $tid,$dsql,$id;
                  $tid = $defaulttid ? $defaulttid : $tid;
                  if ($id!="")
                  {
                   $tidsq = $dsql->GetOne(" Select typeid From `dede_archives` where id='$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` where id='$channelid' ");
                  $fieldset=$cInfos['fieldset'];
                  $dtp = new DedeTagParse();
                     $dtp->SetNameSpace('field','<','>');
                     $dtp->LoadSource($fieldset);
                     $dede_addonfields = '';
                     if(is_array($dtp->CTags))
                     {
                         foreach($dtp->CTags as $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 .= '<dl><dt>'.$ctag->GetAtt('itemname').':</dt><dd>';
                     switch ($type) {
                      case 1:
                       $dede_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? '<a title="全部" href="'.str_replace("&".$ctag->GetName()."=".$fields_value,"",$filterarr).'">全部</a>' : '<dd><a class="on">全部</a>').'&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]) ? '<a title="'.$addonfields_items[$i].'" href="'.$href.'">'.$addonfields_items[$i].'</a>' : '<a class="on">'.$addonfields_items[$i].'</a>')."&nbsp;";
                       }
                       $dede_addonfields .= '</dl>';
                      break;
                     
                      case 2:
                       $dede_addonfields .= '<select name="filter"'.$ctag->GetName().' onchange="window.location=this.options[this.selectedIndex].value">
                        '.'<option value="'.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 .= '<option value="'.$href.'"'.($fields_value==urlencode($addonfields_items[$i]) ? ' selected="selected"' : '').'>'.$addonfields_items[$i].'</option>
                        ';
                       }
                       $dede_addonfields .= '</select><br/>
                       ';
                      break;
                     }
                             }
                         }
                     }
                  echo $dede_addonfields;
                 }




                第三步:到这里PHP文件修☆改的部分就完成了!接下来就◥需要给指定的模型添加字段了,这里需要注意的就是 字段类型的选择,字段类ぷ型需要选择单选按钮或者使用select下拉框,如下图所示:
                织梦DEDECMS5.7实现联动筛选(支¤持多条件多级选项)
                第四部: 前台调用标∩签 {dede:php}AddFilter(3,1,'fenleia,fenleib,fenleic');{/dede:php}
                注:标签说明: AddFilter函数里面的第一个数字3是内容模型的id号,各个内容模型的id请到后台内容模型管理里@ 面查看; 第二个数字1是表示筛选的样式,1是使用超链■接进行选择,2是使用select下拉框▽选择,具体可以自己设置了查看效果; 第三个部分'fenleia,fenleib,fenleic'是要︻添加筛选功能的字段名,这里有3个字段,注意需要用半角逗号隔开。
                注:列表页要用{dede:list pagesize='15'  titlelen='60'  addfields='mobanyouhuijia' channelid='2'}这□ 样的标签,选择要有效


                本文链接:/g61cg2/dedecmsjiaocheng/chengxukaifa/150375.html

                版权声明:本站资源均来自互联网或会员发布,如果侵犯了您的※权益请与我们联系,我们将在24小时内删『除!谢谢!

                公众号二维码

                微信公众号

                //自动推送