2012-11-09 54 views
3

我有簡單的線條,但它不起作用。如何在joomla控制器中加載不同的視圖?

$this->getView($input->get('my_wiew', 'Sites', 'CMD'), 'HTML'); 
//some code 
parent::display(); 

如果我簡單的去到URL index.php?option=com_my_component&view=sites我得到我的觀點,但默認情況下它不希望加載。

回答

5
$view = $this->getView('view_name', 'html'); //get the view 
$view->assignRef('data', $data_from_model); // assign data from the model 
$view->display(); // display the view 

Read more

在這種情況下在view.html.php`$這 -
+0

> getModel()'不起作用 – user1692333

+0

$模型\t = $這 - > getModel( '模型名稱');試試這個 – Techie

+0

沒有運氣......... – user1692333

相關問題