我尝试了两个选项(可以在互联网上找到)并没有进展:
//in controller
$show_all = TRUE;
$view->assignRef('show', $show_all);
//in default.php and viev.html.php
$this->show;
//result
Notice: Undefined property: componentViewcomponent::$show
//in controller
$show_all = TRUE;
$view->assign('show', $show_all);
//in default.php and viev.html.php
$this->get('show');
//result
NULL
答案 0 :(得分:1)
$model = $this->getModel('mymodel'); //get the model
$data_list = $model->getSomeData();//get data from the model
$view = $this->getView('view_name', 'html'); // get the view
$view->assignRef('data_list', $data_list); // set the data to the view
$view->display(); // show the view
这是我过去1年一直在使用的东西,它总是适合我。