Pbootcms二次开发之获取指定栏目的父栏目id
修改文件:apps/home/model/ParserModel.php
增加函数:
//获取父分类id
public function getSortpid($scode)
{
$result = $this->getSortList();
return $result[$scode]['pcode'];
}
在需要此方法的文件中,获取
{php}
$Parsers=new app\home\model\ParserModel;
$parentname = $Parsers->getSortName($value->pcode);
$ppid = $Parsers->getSortpid($value->pcode);
$pp_name = $Parsers->getSortName($ppid);
$top_id = $Parsers->getSortTopScode($value->scode);
$top_name = $Parsers->getSortName($top_id);
if($parentname == $top_name){
$top_name='';
}
{/php}