打开 \include\extend.func.php 在最下面加入
01/**
02 * 获取副栏目链接和名称
03 *
04 * @access public
05 * @param string $typeid2 副栏目id
06 * @param string $result 输出
07 * @return string
08 */
09if(!function_exists('GetTypeid2'))
10{
11function GetTypeid2($typeid2)
12{
13global $dsql;
14$result = '';
15$query = "SELECT * FROM `dede_arctype` WHERE id IN($typeid2) AND ishidden<>1 ORDER BY FIELD(id,$typeid2)";
16$dsql->Execute('t',$query);
17while($row = $dsql->GetArray('t'))
18{
19$typeurl = GetOneTypeUrlA($row);
20$result.= ($result=='' ? "{$row['typename']}" : ','."{$row['typename']}");
21}
22return $result;
23}
24}
列表页 调用标签写法
1[field:typeid2 function=GetTypeid2(@me)/]
内容页 调用标签写法
1{dede:field.typeid2 function=GetTypeid2(@me)/}
首页 调用标签
还需要打开 /include/taglib/arclist.lib.php 找到
1if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')';
改成
1if($CrossID=='') $orwheres[] = " (arc.typeid in (".GetSonIds($typeid).") or arc.typeid2 in (".GetSonIds($typeid).") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%' )";
继续找到
1else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')';
改成
1else $orwheres[] = " (arc.typeid in (".GetSonIds($typeid).",".$CrossID.") or arc.typeid2 in (".GetSonIds($typeid).",".$CrossID.") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%')";
这样才可以在首页调用副栏目,标签写法是
1[field:typeid2 function=GetTypeid2(@me)/]