Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 method JController::getInstance() in /home/evolve13/public_html/components/components/com_donation/donation.php on line 9

Here is the code of 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();
like image 869
Fredrick Boaz Avatar asked Feb 28 '26 00:02

Fredrick Boaz


1 Answers

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

like image 192
user3769445 Avatar answered Mar 02 '26 15:03

user3769445



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!