<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

织梦获取当前栏目顶级栏目代码

时间:2020-12-15

在用织梦做一些项目时,时常会碰到需要在当前页面调用顶级栏目名称的时候,织梦默认{dede:field name='typename' /} 
可以获取当前栏目页上一级栏目的名称,而不是当前栏目顶级栏目名称。
下面拓展出一个方法来实现这个效果、:
在include/common.func.php的最下方加入:
//获取顶级栏目名
function GetTopTypename($id)
{
    global $dsql;
   
 $row = $dsql->GetOne("SELECT typename,topid FROM dede_arctype WHERE id= 
$id");
    if ($row['topid'] == '0')
    {
        return 
$row['typename'];
    }
    else
    {
        $row1 = 
$dsql->GetOne("SELECT typename FROM dede_arctype WHERE id= 
$row[topid]");
        return $row1['typename'];
    }
}
在文章页或者栏目列表页调用时,在所要调用 名称的位置加上下面这行代码即可实现。
{dede:field name='typeid' function="GetTopTypename(@me)" /}

在文章页中用下面这个方法来调用
{dede:field name='typeid' function="GetTopTypename(@me) /}
0
首页
案例
关于
联系