Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

织梦教程DedeCMS系统副栏目调用支持arclist标签

织梦教程dedecms副栏目调用支持arclist标签!织梦cms可以将一个文章放入到2个栏目,一个是文档主栏目,一个是文档副栏目,而最终的管理是在主栏目中,但是被放入到副栏目的文档同样是可以在副栏目的前台列表页中展示。

织梦教程dedecms副栏目调用支持arclist标签!织梦cms可以将一个文章放入到2个栏目,一个是文档主栏目,一个是文档副栏目,而最终的管理是在主栏目中,但是被放入到副栏目的文档同样是可以在副栏目的前台列表页中展示,这样就方便了一些有特殊栏目要求的需求。

但问题来了,经常我们不仅仅是需要在列表页中去展示,也需要在首页或者其他页面中展示,这样就需要用到了arclist这样一个标签来进行调用。但是,你会发现,默认在arclist中是无法直接调用副栏目的文档出来的。

其原因就是因为arclist标签文件中相关的php代码函数不支持副栏目的调取,这个时候只需要将相关的代码进行更改,就可以让arclist支持副栏目的调用了。如何修改,可以参考以下解决方案中提供的代码直接替换。

查找根目录下/include/taglib/arclist.lib.php这个文件

打开arclist.lib.php

找到大概在261行代码的地方,将以下代码

$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) ";

在找到大概在303行代码的地方,将以下代码

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.') '; }

通过以上办法,可以有效地解决了DEDECMS不支持通过arclist标签调用副栏目文章的问题。

温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
编程技巧

织梦教程dedecms系统调用显示discuz里面主题的方法

2016-2-10 9:00:00

编程技巧

Shell命令将文件名修改为小写

2016-2-12 9:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索