J5詳情頁(yè)獲取當(dāng)前分類父分類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、模板調(diào)用
獲取ID:{$[Fcategory]}
調(diào)用分類名:{$=$render('index.category-detail', $fetch(['genre' => 'universal/category', 'where' => ['genre' => '{$>this.genre}', 'id' => {$[Fcategory]}]]))}