明:本文为博主原创文章,未经博主允许不得转载
http://blog.csdn.net/qq_29362889/article/details/53762174。
http://blog.csdn.net/qq_29362889/article/details/53762174。
找到目录下的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'];
}
}
}