|
今天小编给出一个函数,解决织梦获取当前栏目的顶级栏目的办法,找到织梦里的include/extend.func.php 加入如下函数:
01 function GetTopTypeName($typeid)
{
global $dsql;
$typeRow = $dsql->GetOne("SELECT typename,topid FROM dede_arctype WHERE id= $typeid");
if ($typeRow['topid', == '0')
{
return $typeRow['typename',;
}
else
{
$typeRow1 = $dsql->GetOne("SELECT typename FROM dede_arctype WHERE id= $typeRow[topid,");
return $typeRow1['typename',;
}
}
然后在模板里面通过标签{dede:field.typeid function=“GetTopTypeName(@me)”}即可 |
|