Fatal error: call to undefined method JController :: getInstance () in joomla 3

I am trying to upgrade a component from joomla2.5 to joomla 3 but I am getting this error:

Fatal error: Call to undefined JController :: getInstance () method in / home / evolve 13 / public_html / components / components / com_donation / donation.php on line 9

Here is the donation.php code:

<?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();

      

+3


source to share


1 answer


In Joomla 3X, you need to use legacy controllers ... try the following code. Change JController::getInstance('Donation');


KJControllerLegacy::getInstance('Donation');



+3


source







All Articles