dede发表文章归属多个栏目的方法
作者:秋了秋 发表时间:2015年12月01日
很多人认为dede发表的文章不能归属为多个栏目下,对,没错,dede默认是不能在多个栏目的列表下显示同一篇文章或者商品。主要还是arclist标签的问题,所以我们可以通过修改系统文件函数来调用出来。虽然不能默认显示多个栏目下,但是可以归属为多个栏目。使用副栏目增加归属分类:
虽然在副栏目勾选了多个栏目,但在这些栏目前台依然不会显示的。下面我们来修改系统函数:
1.查找dede安装目录下的/include/taglib/arclist.lib.php 文件。
2.用编辑器打开这个文件,搜索:
复制代码
- $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) ";
复制代码
3.查找:
复制代码
- 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.') ';
- }
复制代码
这样就可以在前台分类目录下通过{dede:arclist}[field:image/]{/dede:arclist}标签调用出来了。
0
文章作者: “秋了秋”个人博客,本站鼓励原创。
转载请注明本文地址:http://netblog.cn/blog/415.html