当前位置:首页 »“秋了秋”个人博客 » 网站建设 » dede发表文章归属多个栏目的方法

dede发表文章归属多个栏目的方法

作者:秋了秋 发表时间:2015年12月01日

很多人认为dede发表的文章不能归属为多个栏目下,对,没错,dede默认是不能在多个栏目的列表下显示同一篇文章或者商品。主要还是arclist标签的问题,所以我们可以通过修改系统文件函数来调用出来。虽然不能默认显示多个栏目下,但是可以归属为多个栏目。使用副栏目增加归属分类:

dede发表文章归属为多个栏目

虽然在副栏目勾选了多个栏目,但在这些栏目前台依然不会显示的。下面我们来修改系统函数:

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
目录: 网站建设标签: 多个栏目分类 10448次阅读

请求播放音乐,请点击播放

登 录
点击获取验证码
还没账号?点击这里