栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

DedeCMS 新建模型自定义联动类别调用及修改方法

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

DedeCMS 新建模型自定义联动类别调用及修改方法

找了好几天资料,没找到新建模型中自定义联动类别怎么用,自己就改了改..现在可以用了 把方法分享一下...不对的地方请大家帮助改正。   先修改 includetaglibinfolink.lib.php 文件   require_once(DEDEROOT.'/data/enums/infotype.php');  下面添加  require_once(DEDEROOT.'/data/enums/自定义联动类别字段名.php');    function lib_infolink(&$ctag,&$refObj)  {  global $dsql,$nativeplace,$infotype,$自定义联动类别字段名,$hasSetEnumJs,$cfg_cmspath,$cfg_mainsite;  global $em_nativeplaces,$em_infotypes,$em_自定义联动类别字段名s; //看清楚,这里后面的个S    $fields = array('nativeplace'=>'','infotype'=>'','自定义联动类别字段名'=>'','typeid'=>$typeid,  'channelid'=>$channelid,'linkallplace'=>'','linkealltype'=>'','linkeall自定义联动类别字段名'=>'');    $fields['nativeplace'] = $fields['infotype'] = $fields['自定义联动类别字段名'] = '';    $fields['linkalltype'] = "不限";    //下面添加一行    $fields['linkeall自定义联动类别字段名'] = "不限";    搜索 if(is_array($ctp->CTags)) 在这句上面添加    //自定义联动类别字段链接  if(empty($自定义联动类别字段名))  {  foreach($em_自定义联动类别字段名s as $eid=>$em)  {  if($eid % 500 != 0) continue;  $fields['自定义联动类别字段名'] .= " {$em}";  }  }  else  {  $sontype = ( ($自定义联动类别字段名 % 500 != 0) ? $自定义联动类别字段名 : 0 );  $toptype = ( ($自定义联动类别字段名 % 500 == 0) ? $自定义联动类别字段名 : ( $自定义联动类别字段名-($membertype%500) ) );  $fields['自定义联动类别字段名'] = "{$em_自定义联动类别字段名s[$toptype]} ";  foreach($em_自定义联动类别字段名s as $eid=>$em)  {  if($eid < $toptype+1 || $eid > $toptype+499) continue;  if($eid == $自定义联动类别字段名) {  $fields['自定义联动类别字段名'] .= " {$em}";  }  else {  $fields['自定义联动类别字段名'] .= " {$em}";  }  }  }    再修改 pluslist.php 文件    搜索 $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype ); 在下面添加一句    $自定义联动类别字段名 = ( (empty($自定义联动类别字段名) || !is_numeric($自定义联动类别字段名)) ? 0 : $自定义联动类别字段名 );    再搜索 if(!empty($infotype)) $cArr['infotype'] = $infotype;    在下面添加  if(!empty($自定义联动类别字段名)) $cArr['自定义联动类别字段名'] = $自定义联动类别字段名;      找到 includearc.sglistview.class.php 文件    搜索 if(!empty($this->searchArr['keyword'])) 在上面添加    //自定义联动类别    if(!empty($this->searchArr['自定义联动类别字段名']))  {  if($this->searchArr['自定义联动类别字段名'] % 500 ==0 )  {  $naddQuery .= " And arc.自定义联动类别字段名 >= '{$this->searchArr['自定义联动类别字段名']}' And arc.自定义联动类别字段名 < '".($this->searchArr['自定义联动类别字段名']+500)."'";  }  else  {  $naddQuery .= "And arc.自定义联动类别字段名 = '{$this->searchArr['自定义联动类别字段名']}'";  }  }   模板调用     [field:linkeall自定义联动类别字段名/] [field:自定义联动类别字段名 /]
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/6365.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号