参考字段划分我想给内容页做划分我研究了下栏目划分是加了个参数 迅睿框架 更新 2020-11-25 16:24:53 小黄人 18html.com 参考字段划分我想给内容页做划分我研究了下栏目划分,是加了个 diy 参数请问,怎么读取这个diy,去赋予页面不同字段?求老大,demo 一段!入库,设置diy参数,我知道怎么写,但是不知道怎么在指定数据页,比如 add edit 页面调用属于它自己id的字段
public function __construct(...$params) { parent::__construct(...$params); $field = \Phpcmf\Service::M('field')->get_mytable_field('abcd', 0); $this->_init([ 'table' => 'abcd', 'field' => $field, ]); // 写入模板 \Phpcmf\Service::V()->assign([ 'menu' => \Phpcmf\Service::M('auth')->_admin_menu([ '自定义页面' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/index', 'fa fa-safari'], '添加' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/add', 'fa fa-plus'], '修改' => ['hide:'.APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/edit', 'fa fa-edit'], '自定义字段' => ['url:'.\Phpcmf\Service::L('Router')->url('field/index', ['rname'=>'table-abcd', 'rid'=>0]), 'fa fa-code'], ]), ]); }public function edit() { $field_all = $this->field;// 可用字段 $this->field = []; // 归零 $id = intval(\Phpcmf\Service::L('Input')->get('id')); if ($id == 1) { //表记录1 调用 字段 //重组字段 $this->field['ziduanxxx'] = $field_all['ziduanxxx']; // 这样写 表示id=1的记录 只显示 ziduanxxx字段了 } elseif ($id == 2) { // 同理 } elseif ($id == 3) { // 同理 } elseif ($id == 4) { // 同理 } list($tpl) = $this->_Post($id); \Phpcmf\Service::V()->display($tpl); }$id = intval(\Phpcmf\Service::L('Input')->get('id')); $field_all = $this->field;// 可用字段 $this->field = []; // 归零 foreach ($field_all as $f) { if(in_array($id,$f['setting']['diy']['cat_field_catids'])){ $this->field[$f['fieldname']] = $field_all[$f['fieldname']]; } }