0
我在joomla 2.5中編寫了一個組件。我想要一個視圖在視圖上使用多個模型。我看到Multiple models for a view without controllers。視圖上的多個模型Joomla 2.5
我的代碼: 在類控制器(Controller.php這樣)
public function display($cachable = false, $urlparams = false)
{
AppHelper::addSubmenu(JRequest::getCmd('view', 'apps'));
JRequest::setVar('view', JRequest::getCmd('view', 'apps'));
$model = $this->getModel('app'); // get first model
$view = $this->getView('apps', 'html'); // get view we want to use
$view->setModel($model, true); // true is for the default model
$vermodel = &$this->getModel('version'); // get second model
$this->assignRef('version', $vermodel);
$view->setModel($vermodel);
var_dump($this);
parent::display($cachable);
return $this;
}
在類視圖(view.html.php)
public function display($tpl = null)
{
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->form2 = $this->get('Form', 'version');
// var_dump($this->form2);
}
但是,圖不能顯示以形成! !
幫幫我!謝謝你們。的
您是否檢查過 - 視圖中是否提供了'版本'模型? –