Warning: include_once(/www/wwwroot/huison.cn/head.php): failed to open stream: Permission denied in /www/wwwroot/huison.cn/show.php on line 48

Warning: include_once(): Failed opening 'head.php' for inclusion (include_path='.:/www/server/php/56/lib/php') in /www/wwwroot/huison.cn/show.php on line 48

Warning: include_once(/www/wwwroot/huison.cn/banner.php): failed to open stream: Permission denied in /www/wwwroot/huison.cn/show.php on line 53

Warning: include_once(): Failed opening 'banner.php' for inclusion (include_path='.:/www/server/php/56/lib/php') in /www/wwwroot/huison.cn/show.php on line 53

修复Dede(织梦)Cms栏目移动后无法正确判断当前选中状态


今天有客户遇到一个问题,他用的是Dede织梦CMS系统,在后台移动了栏目,就是把一个栏目的子级分类移动到另一个栏目下去了。

但是,发现前台页面里,当前子级的页面所在的导航状态还在老栏目上。如下图所示:

不知道这算不算是织梦的一个BUG,打开文件 include/taglib/channelartlist.lib.php ,找到如下代码

if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $newTopId ){  
     $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'active';  
} 
else{ 
     $pv->Fields['currentstyle'] = '';
}

替换成下面的代码:
/**
* Boncent.com
* Date:2017-09-25
*/
if ($refObj->TypeLink->TypeInfos['topid'] == $refObj->TypeLink->TypeInfos['reid']) {
    $newTopId = $refObj->TypeLink->TypeInfos['topid'];
} else {
    $newTopId = $refObj->TypeLink->TypeInfos['reid'];
}

if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $newTopId ){  
    $pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'active';  
} else {  
    $pv->Fields['currentstyle'] = '';  
}
判断当前的父级和移动后的ID是不是相同,如果相同就取父级ID,如果不同,就用移动后的ID。

至此,问题解决!

其它相关文章:

Warning: include_once(/www/wwwroot/huison.cn/foot.php): failed to open stream: Permission denied in /www/wwwroot/huison.cn/show.php on line 126

Warning: include_once(): Failed opening 'foot.php' for inclusion (include_path='.:/www/server/php/56/lib/php') in /www/wwwroot/huison.cn/show.php on line 126