/**
* 获取副栏目链接和名称
*
* @access public
* @param string $typeid2 副栏目id
* @param string $result 输出
* @return string
*/
if(!function_exists('GetTypeid2'))
{
function GetTypeid2($typeid2)
{
global $dsql;
$result = '';
$query = "SELECT * FROM `dede_arctype` WHERE id IN($typeid2) AND ishidden<>1 ORDER BY FIELD(id,$typeid2)";
$dsql->Execute('t',$query);
while($row = $dsql->GetArray('t'))
{
$typeurl = GetOneTypeUrlA($row);
$result.= ($result=='' ? "<a href='{$typeurl}'>{$row['typename']}</a>" : ','."<a href='{$typeurl}'>{$row['typename']}</a>");
}
return $result;
}
}
|
[field:typeid2 function=GetTypeid2(@me)/]
|
{dede:field.typeid2 function=GetTypeid2(@me)/}
|
还需要打开 /include/taglib/arclist.lib.php 找到
if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')';
|
改成
if($CrossID=='') $orwheres[] = " (arc.typeid in (".GetSonIds($typeid).") or arc.typeid2 in (".GetSonIds($typeid).") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%' )";
|
继续找到
else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')';
|
改成
else $orwheres[] = " (arc.typeid in (".GetSonIds($typeid).",".$CrossID.") or arc.typeid2 in (".GetSonIds($typeid).",".$CrossID.") or CONCAT( ',', arc.typeid2, ',' ) LIKE '%,".$typeid.",%')";
|
这样才可以在首页调用副栏目,标签写法是
[field:typeid2 function=GetTypeid2(@me)/]
|
一、
DEDEcontent_list.php 查找
$query = "Select arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,
|
$query = "Select arc.id,arc.typeid,arc.typeid2,arc.senddate,arc.flag,arc.ismake,
|
二、dede empletscontent_list.html
查找:
{dede:field.flag function='IsCommendArchives(@me)'/}
|
下面增加:
{dede:field.typeid2 function="Typeid2Archives(@me)"/}
|
(责任编辑:admin) |