How to call the top-level column of the current column in the dream weaving content page

Weaving dream secondary development network gives a function to solve how to get the top column of the current column in the content page, find the include/extend.func.php in weaving dream and add the following function

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'];
    }
}

Then pass the tag {dede:field.typeid function="GetTopTypeName(@me)"} in the template

This is how the ninth question and answer nine is used, it is very easy to use, save it for use!

Guess you like

Origin blog.csdn.net/hbznd/article/details/114326829