首页 > 教程 >
织梦多个栏目arclist调用副栏目不显示的解决办法
2023-02-27教程围观次
简介织梦dedecmsarclist调用副栏目不显示的解决办法。打开/include/taglib/arclist.lib.php,代码约位于295-296行,查找以下两行代码:if($CrossID=='')$orwheres[]='arc.typeidIN('.GetSonIds($typeid).')';else$orwheres[]='arc.typeidIN('.GetSonIds($typ
织梦dedecms arclist调用副栏目不显示的解决办法。 打开/include/taglib/arclist.lib.php,代码约位于295-296行,查找以下两行代码: if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')'; else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')'; 将其替换成以下代码: $vicewheres = ""; $typeids = explode(",",GetSonIds($typeid)); $crossids = explode(",",$CrossID); $typeidss = array_merge($typeids,$crossids); $typeidss = array_unique($typeidss); foreach($typeidss as $tid){ $liketypeid2 = ",".$tid.","; $vicewheres.= " or CONCAT(',',arc.typeid2,',') like '%$liketypeid2%' "; } if($CrossID==''){ if($vicewheres!="") $orwheres[] = ' (arc.typeid in ('.GetSonIds($typeid).') '.$vicewheres.') '; else $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).') '; }else{ if($vicewheres!="") $orwheres[] = ' (arc.typeid in ('.GetSonIds($typeid).','.$CrossID.') '.$vicewheres.') '; else $orwheres[] = ' arc.typeid in ('.GetSonIds($typeid).','.$CrossID.') '; } 这种办法可以解决typeid="2"的情况下不显示副栏目的问题, 如果typeid=“2,3,8”,有多个栏目需要调用副栏目就不行了 怎么解决这个问题,找到262行, $orwheres[] = " arc.typeid IN ($typeid) "; 直接替换为: $vicewheres = ""; foreach($typeid as $tid){ $liketypeid2 = ",".$tid.","; $vicewheres.= " or CONCAT(',',arc.typeid2,',') like '%$liketypeid2%' "; } if($vicewheres!="") $orwheres[] = " (arc.typeid in ($typeid) $vicewheres) "; else $orwheres[] = " arc.typeid in ($typeid) "; 问题产生的原因,看下arclist.lib.php原始代码:( typeid为主栏目id, typeid2为副栏目id) 找到246行: //指定了多个栏目时,不再获取子类的id if( preg_match('#,#', $typeid) ) //如果typeid字段匹配逗号, 就是说typeid调用多个栏目,例如:typeid=“2,3,8” { //指定了getall属性或主页模板例外 if($getall==1 || empty($refObj->Fields['typeid'])) { $typeids = explode(',', $typeid); foreach($typeids as $ttid) { $typeidss[] = GetSonIds($ttid); } $typeidStr = join(',', $typeidss); $typeidss = explode(',', $typeidStr); $typeidssok = array_unique($typeidss); $typeid = join(',', $typeidssok); } $orwheres[] = " arc.typeid IN ($typeid)"; //导致typeid='2,3,8'情况下不能调用副栏目问题产生的地方 } else //如果typeid不匹配逗号,就是调用一个栏目 例如 typeid="2" { //处理交叉栏目 $CrossID = ''; if($ctag->GetAtt('cross')=='1') { $arr = $dsql->GetOne("SELECT `id`,`topid`,`cross`,`crossid`,`ispart`,`typename` FROM `dede_arctype` WHERE id='$typeid' "); if( $arr['cross']==0 || ( $arr['cross']==2 && trim($arr['crossid']=='') ) ) { $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')'; } else { $selquery = ''; if($arr['cross']==1) { $selquery = "SELECT id,topid FROM `dede_arctype` WHERE typename LIKE '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}' "; } else { $arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid'])); if($arr['crossid']!='') $selquery = "SELECT id,topid FROM `dede_arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}' "; } if($selquery!='') { $dsql->SetQuery($selquery); $dsql->Execute(); while($arr = $dsql->GetArray()) { $CrossID .= ($CrossID=='' ? $arr['id'] : ','.$arr['id']); } } } } if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')'; else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')'; //导致typeid='2'情况下不能调用副栏目问题产生的地方 } |
下载链接:网站源码/小程序源码/网站模板下载
下载排行
- WordPress主题 JustNews5.2.2 + QAPress问答插件适合源码站虚拟资源站个人博客
- 最新去水印小程序源码分享/无需后台/对接接口/支持全网去水印功能
- 知识付费小程序源码升级版知识付费变现小程序源码+卡密-独立后台版本
- 自带多平台解析接口短视频去水印图集水印小程序源码下载
- ThinkPHP高仿蓝奏云网盘系统源码/对接易支付系统程序
- TooNaughty网址导航主题/WordPress主题下载
- 某鱼最近卖的很火蓝色版微信去水印小程序源码+接口
- 起点导航系统源码最新V2.6开源可运营版
- 最新短视频去水印小程序源码/带流量主/外卖CPS系统/批量解析/修改MD5
- 新版多功能去水印工具微信小程序源码下载+带流量主功能