织梦cmsarclist启用副频道无法显示的解决方案:
开启/include/taglib/arclist.lib.php,编码约坐落于295-296行,搜索下列二行编码:
if($CrossID=='')$orwheres[]='arc.typeidIN('.GetSonIds($typeid).')';else$orwheres[]='arc.typeidIN('.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.typeidIN($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行:
//特定了好几个频道时,已不获得子类的idif(preg_match('#,#',$typeid))//假如typeid字段名配对分号,就是typeid启用好几个频道,比如:typeid=“2,3,8”
{
//特定了getall特性或主页模板列外
if($getall==1||empty($refObj->Fields['typeid']))
{
$typeids=explode(',',$typeid);
foreach($typeidsas$ttid){
$typeidss[]=GetSonIds($ttid);
}
$typeidStr=join(',',$typeidss);
$typeidss=explode(',',$typeidStr);
$typeidssok=array_unique($typeidss);
$typeid=join(',',$typeidssok);
}
$orwheres[]="arc.typeidIN($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`WHEREid='$typeid'");
if($arr['cross']==0||($arr['cross']==2&&trim($arr['crossid']=='')))
{
$orwheres[]='arc.typeidIN('.GetSonIds($typeid).')';
}
else
{
$selquery='';
if($arr['cross']==1){
$selquery="SELECTid,topidFROM`dede_arctype`WHEREtypenameLIKE'{$arr['typename']}'ANDid<>'{$typeid}'ANDtopid<>'{$typeid}'";
}
else{
$arr['crossid']=preg_replace('#[^0-9,]#','',trim($arr['crossid']));
if($arr['crossid']!='')$selquery="SELECTid,topidFROM`dede_arctype`WHEREidIN('{$arr['crossid']}')ANDid<>'{$typeid}'ANDtopid<>'{$typeid}'";
}
if($selquery!='')
{
$dsql->SetQuery($selquery);
$dsql->Execute();
while($arr=$dsql->GetArray())
{
$CrossID.=($CrossID==''?$arr['id']:','.$arr['id']);
}
}
}
}
if($CrossID=='')$orwheres[]='arc.typeidIN('.GetSonIds($typeid).')';
else$orwheres[]='arc.typeidIN('.GetSonIds($typeid).','.$CrossID.')';//造成 typeid='2'状况下不可以启用副频道难题造成的地区
}
未经允许不得转载! 作者:访客,转载或复制请以超链接形式并注明出处x36交易网。
原文地址:https://www.x36.cn/post/2420.html发布于:2020-07-17