修改 include/helpers/extend.helper.php
结尾增加 :
调用代码
结尾增加 :
/*** 获取一个类目的顶级栏目* @param string $tid 栏目ID* @return string*/if ( ! function_exists('gettoptype')){function gettoptype($tid,$action){global $dsql,$cfg_Cs;if(!is_array($cfg_Cs)){require_once(DEDEDATA."/cache/inc_catalog_base.inc");}if(!isset($cfg_Cs[$tid][0]) || $cfg_Cs[$tid][0]==0){$topid = $tid;}else{$topid = GetTopid($cfg_Cs[$tid][0]);}$row = $dsql->GetOne("SELECT * FROM `arctype` WHERE id=$topid");$toptypename = $row['typename'];$toptypeurl = $topid;if($action=='id') return $topid;if($action=='name') return $toptypename;if($action=='link') return GetOneTypeUrlA($row);}} |
调用代码
{dede:field.typeid function="gettoptype(@me,id)"/} //id {dede:field.typeid function="gettoptype(@me,name)"/} //名称 {dede:field.typeid function="gettoptype(@me,link)"/} //链接 |