我有一個組件,我需要註冊第二個視圖。當我編碼我的網址,從設置視圖varialbe:Joomla - MVC模型/查看註冊
http://www.mysite.com/index.php?option=com_mycom&view=view1
到
http://www.mysite.com/index.php?option=com_mycom&view=view2
視圖2將不顯示。
我是否需要在控制器中註冊第二個視圖?你能指點我一個參考嗎?谷歌搜索已經沒有了。
編輯
的視圖2代碼:
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
/**
* HTML View class for the mls Component
*
* @package UniversalDynamicMedia.com
* @subpackage Components
*/
class mlsViewlist extends JView
{
function display($tpl = null)
{
$model = &$this->getModel();
$array = $model->mlsListData();
$disparray = foreach ($array as list($a,$b,$c,$d,$e)) {
echo <tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td><td>$e</td></tr>
}
$this->assignRef('disparray', $disparray);
parent::display($tpl);
}
}
?>
爲什麼你在URL中代替'&'代替'&'?這是一個錯字嗎? – MrCode
錯字。我已修復錯誤。 – Plummer
您不需要註冊視圖,因此您的view2代碼必須存在問題,請顯示view.html.php代碼。 – MrCode