0

我尝试了两个选项(可以在互联网上找到)但没有进展:

//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
4

1 回答 1

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 年一直在使用的,它总是对我有用。

于 2012-10-31T05:19:38.993 回答