J5详情页获取当前分类父分类ID

weeya3年前JTBC教程1051

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]}]]))}

相关文章

J5_04产品新闻列表页

1、头尾模板调用代码{$=$take('global.communal.header')}{$=$take('global.communal.footer')}1、模块...

J5_03首页模板

1、头尾模板调用代码{$=$take('global.communal.header')}{$=$take('global.communal.footer')}2、调用...

J5网站首页增加SEO标题

网站增加首页标题1、/Public/common/language/communal.jtbc文件增加节点    <item>  &nbs...

J5_01安装相关

JTBC5.0笔记jtbc模板里只要理解3个东西就完事儿了1个叫 $take1个叫 $render另外1个叫 $fetch/Config/DB/MySQL.php,数据库链接~~~~~~~~~~~~~...

J5增加PDF附件下载功能

1、模块管理增加att字段,选择29附件管理器2、模板代码<table class="table table-striped m-0"><tbody><...

J5伪静态

Public/news/.rewrite的地址重写配置:<?phpreturn [  [    'file' => 'ind...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。