Joomla 2.5 - 组件致命错误

时间:2015-12-31 16:21:29

标签: joomla2.5

当我在Joomla 2.5中制作组件时,我遇到了这个错误:

Fatal error: Call to a member function reset() on a non-object in
/var/www/html/joomla/libraries/joomla/application/component/modeladmin.php
on line 850

1 个答案:

答案 0 :(得分:-1)

我发现:点击发布或取消发布时,首先在我的项目中运行此控制器,这个名称是:

notic:首先运行此文件

com_contactus / controllers / categories.php

<?php
defined( '_JEXEC' ) or die();
jimport ('joomla.application.component.controlleradmin');

      echo "run first this file ";

 class contactusControllerCategories extends JControllerAdmin
{

    public function getModel($name='Category',$prefix='contactusModel',$config=array('ignore_request'=>true))
    {

        $model = parent::getModel($name,$prefix,$config);
        return $model;
    }
}

运行之后,Top文件导致此文件当然是gettable方法

com_contactus / models / category.php

<?php
defined( '_JEXEC' ) or die();
jimport ('joomla.application.component.modeladmin');

class contactusModelCategory extends JModelAdmin
{

    public function getTable($type='Category',$prefix='contactusTable',$config=array())
    {
       echo "second "; 
        return JTable::getInstance ($type,$prefix,$config);

    }


    protected function loadFormData()
    {

        $data = JFactory::getApplication()->getUserState('com_contactus.edit.category.data',array());
        if (empty($data))
        {
            $data = $this->getItem();
        }
        return $data;
    }



    function getForm($data=array(),$loadData=true)
    {

        $form = $this->loadForm('com_contactus.category','Category',array('control'=>'jform' , 'load_data'=>$loadData));
        return $form;

    }

}    

之后运行两个文件将此文件用于运行

com_contactus / tables / category.php

<?php
defined( '_JEXEC' ) or die();
jimport ('joomla.database.table');
   echo "three ";
   die();
class contactusTableCategory extends JTable
{

    public function __construct (&$db)
    {

        parent::__construct('#__contactus','id',$db);
    }

}



 one of  my wrong:
    . I put the wrong  tabels instead tables name in project
相关问题