2015-12-31 63 views
-2

當我做組件中的Joomla 2.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 
+0

你可以添加代碼嗎? –

+0

請勿重複發帖。 –

回答

0

,我發現:當點擊發布或不發佈第一次運行該控制器比較在我的項目這個名字是:

諾蒂奇:運行第一這個文件

com_contactus /控制器/ 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; 
    } 
} 

運行除此之外文件RUND這個文件當然gettable方法

com_contactus /模型/ 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; 

    } 

}  

了將運行towice文件後RUND這個文件運行後

com_contactus /表/ 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