Hi I am new to Joomla and PHP and working on Joomla 3.4 to create a controller.
However I am getting the error as unknown class:'JController'
I am using the below code in my controller.php
<?php
defined('_JEXEC') or die("Access Deny");
jimport('joomla.controller');
class MycompController extends JController{
function display(){
echo JText::_('COM_MYCOMP_WELCOME');
}
function create(){
echo JText::_('Create a ner task');
}
function list_task(){
echo JText::_('Create a list task');
}
function help(){
echo JText::_('Help Section: Checkout the docs');
}
}
?>
I know its only related to including controller.php from its path. But I am not getting by using jimport.
I guess you are on Joomla! 3.x? In which case JController is no longer used as it is being deprecated.
You need to use JControllerLegacy See:
https://docs.joomla.org/JController_and_its_subclass_usage_overview
On other controller usages.