致命错误:在joomla 3中调用未定义的方法JController :: getInstance()

时间:2014-12-06 06:23:27

标签: php joomla components joomla-component joomla3.3

我正在尝试将组件从joomla2.5升级到joomla 3  但是我收到了这个错误:

  

致命错误:在第9行的/home/evolve13/public_html/components/components/com_donation/donation.php中调用未定义的方法JController :: getInstance()

以下是donation.php的代码:

<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by Donation
JController::getInstance('Donation');

// Perform the Request task
$controller->execute(JRequest::getCmd('task'));

// Redirect if set by the controller
$controller->redirect();

1 个答案:

答案 0 :(得分:3)

在Joomla 3X上,您需要使用旧版控制器...尝试以下代码。 更改JController::getInstance('Donation');
JControllerLegacy::getInstance('Donation');