J5详情页获取当前分类父分类ID
1、修改程序 /public/zhiwu/common/template/index.jtbc文件
public function detail(Request $req, Response $res)
//
$fatherCategory = 0;
$fatherCategory = $this -> category -> getRecordById($rsCategory, 'father_id') ?: $rsCategory;
$variables = [
'category' => $rsCategory,
'Fcategory' => $fatherCategory,
];
//
//$variables = ['category' => $rsCategory];屏蔽
2、模板调用
获取ID:{$[Fcategory]}
调用分类名:{$=$render('index.category-detail', $fetch(['genre' => 'universal/category', 'where' => ['genre' => '{$>this.genre}', 'id' => {$[Fcategory]}]]))}