好的,我一直在關注joomla 2.5教程here,並且我設法制作了一個無故障的初始組件。如何初始化我的自定義joomla 2.5模型?
但我想知道如何導入額外的類到框架?
我有一個名爲auth.php模型類
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla modelitem library
jimport('joomla.application.component.modelitem');
/**
* Auth Model
*/
class AutoBaseModelAuth extends JModelItem
{
function detail()
{
echo "this is test";
}
}
位於C:/xampp/htdocs/com_autobase/model/auth.php
xampp http://iforce.co.nz/i/p5m1gjxh.jpx.png
而我的看法...
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* HTML View class for the AutoBase Component
*/
class AutoBaseViewAutoBase extends JView
{
// Overwriting JView display method
function display($tpl = null)
{
$db =& JFactory::getDBO();
//request the auth model
$model =& $this->getModel('auth');
$items =& $model->detail();
}
}
但我保持gett這個錯誤忘了,因爲它尚未導入......我一直在約5個不同的網站試圖找出Joomla如何導入新模型。
Notice: Undefined index: auth in C:\xampp\htdocs\libraries\joomla\application\component\view.php on line 413
所以,可以有人請解釋模型如何在初始化的Joomla?和我做錯了什麼..謝謝!
的Joomla的版本得到一個模型的任何地方? – Craig
@cppl剛剛更新了問題標題。 Joomla Version 2.5 – Killrawr