織夢獲取當前欄目的父級欄目
阿新 • • 發佈:2019-01-03
找到目錄下的include/helper/archive.helper.php 檔案新增函式,注意修改表字首
//獲取上級欄目名稱
if ( ! function_exists('GetParentTypename'))
{
function GetParentTypename($id){
global $dsql ;
$reid = $dsql->GetOne("SELECT reid FROM xy_arctype where id=$id");
$reid = $reid['reid'];
if(empty($reid)){ //當前欄目不存在父級id,查詢當前欄目名稱
$row1 = $dsql->GetOne("SELECT typename FROM xy_arctype where id=$id");
return $row1['typename'];
}else{//當前欄目存在父級id,查詢父級欄目名稱
$row1 = $dsql->GetOne("SELECT typename FROM xy_arctype where id=$reid");
return $row1['typename'];
}
}
}
{dede:field.typeid function="GetParentTypename(@me)"/}