dedecms分类信息模型 实现自定义联动字段和普通字段多选条件搜索
2021-03-02 19:10
dedecms织梦 分类信息模型 实现联动字段和自定义普通字段多选条件搜索,联动目前是直接用得地区,
客户制作网站需要实现如下。
修改\plus/list.php
- if($tinfos['issystem']==-1)
- {
- $nativeplace = ( (emptyempty($nativeplace) || !is_numeric($nativeplace)) ? 0 : $nativeplace );
- // $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype );
- //把默认infotype 联动字段改成了直接下拉,所以不能用上门数字判断方法,改为直接下面得获取;
- if(!emptyempty($infotype)) $infotype = FilterSearch($infotype);
- if(!emptyempty($keyword)) $keyword = FilterSearch($keyword);
- //这里就是加得字段,并不是联动字段,
- if(!emptyempty($endtime)) $endtime = FilterSearch($endtime);
- if(!emptyempty($linkman)) $linkman = FilterSearch($linkman);
- if(!emptyempty($tel)) $tel = FilterSearch($tel);
- $cArr = array();
- if(!emptyempty($nativeplace)) $cArr['nativeplace'] = $nativeplace;
- if(!emptyempty($infotype)) $cArr['infotype'] = $infotype;
- if(!emptyempty($keyword)) $cArr['keyword'] = $keyword;
- //这里就是加得字段,并不是联动字段,写入数组带入到另外一个页面
- if(!emptyempty($endtime)) $cArr['endtime'] = $endtime;
- if(!emptyempty($linkman)) $cArr['linkman'] = $linkman;
- if(!emptyempty($tel)) $cArr['tel'] = $tel;
- include(DEDEINC."/arc.sglistview.class.php");
- $lv = new SgListView($tid,$cArr);
- }
在修改:\include/arc.sglistview.class.php
- //这个我改了。不是联动字段不能用判断是否是数字了。
- if(!emptyempty($this->searchArr['infotype']))
- {
- $naddQuery .= "AND arc.infotype like '%{$this->searchArr['infotype']}%' ";
- }
- //在这个下面加入其他条件。
- if(!emptyempty($this->searchArr['keyword']))
- {
- $naddQuery .= "AND arc.title like '%{$this->searchArr['keyword']}%' ";
- }
- //这些下面是加入得。名字都是字段名称.
- if(!emptyempty($this->searchArr['endtime']))
- {
- $naddQuery .= "AND arc.endtime like '%{$this->searchArr['endtime']}%' ";
- }
- if(!emptyempty($this->searchArr['linkman']))
- {
- $naddQuery .= "AND arc.linkman like '%{$this->searchArr['linkman']}%' ";
- }
- if(!emptyempty($this->searchArr['tel']))
- {
- $naddQuery .= "AND arc.tel like '%{$this->searchArr['tel']}%' ";
- }
再次修改\include/arc.sglistview.class.php 分页带入条件得问题
搜索:function GetPageListDM
- //这里加入自定义自定名称和判断是否为空
- global $nativeplace,$infotype,$keyword,$endtime,$linkman,$tel;
- if(emptyempty($nativeplace)) $nativeplace = 0;
- if(emptyempty($infotype)) $infotype = 0;
- if(emptyempty($keyword)) $keyword = '';
- if(emptyempty($endtime)) $endtime = '';
- if(emptyempty($linkman)) $linkman = '';
- if(emptyempty($tel)) $tel = '';
下面得
- $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&keyword=".urlencode($keyword)."&";
改成加入得自定义字段和from提交得自定义字段:
- $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&endtime=".urlencode($endtime)."&linkman=".urlencode($linkman)."&tel=".urlencode($tel)."&keyword=".urlencode($keyword)."&";
- $hidenform = "<input type='hidden' name='tid' value='".$this->TypeID."' />\r\n";
- $hidenform = "<input type='hidden' name='nativeplace' value='$nativeplace' />\r\n";
- $hidenform = "<input type='hidden' name='infotype' value='$infotype' />\r\n";
- $hidenform = "<input type='hidden' name='keyword' value='$keyword' />\r\n";
- $hidenform = "<input type='hidden' name='endtime' value='$endtime' />\r\n";
- $hidenform = "<input type='hidden' name='linkman' value='$linkman' />\r\n";
- $hidenform = "<input type='hidden' name='tel' value='$tel' />\r\n";
【责任编辑:小戴工程师】
上一篇:photoswipe的展示时图片自适应问题 data-size自动获取问题 下一篇:sql 查询字段是否包含某条件 多条件最新文章
2021-03-02 19:10
相关文章
2021-03-02 19:10