[FIXED] Unable to call specific controller - Joomla! Forum - community, help and support


i'm trying recode joomla 2.5 application work inside joomla 3.3.
this simple admin component.
reading documentation find on joomla 3.3 coding standards see should have separate controller each view, keeping inline i'm trying call specific controller, everytime base controller.php file called.

for example have following url in component :
[url]/administrator/index.php?option=com_questaudit&view=test&task=runtest[/url]

i expecting above url call controller called test (which filename controller/test.php).
then run function runtest controller.
so should open file controllers/test.php
run function runtest in test.php controller
then open runtest view (file views/runtest/view.html.php (using layout default file views/runtest/tmpl/default.php))

what happening base controller (controller.php) called , display function inside controller called , test view displayed.

the code base file (questaudit.php) listed below :

code: select all

defined( '_jexec' ) or die( 'restricted access' );
   
   if (!jfactory::getuser()->authorise('core.manage', 'com_questaudit'))
   {
      return jerror::raisewarning(404, jtext::_('jerror_alertnoauthor'));
   }
   
   $controller  = jcontrollerlegacy::getinstance('questaudit');
   $controller->execute(jfactory::getapplication()->input->get('task'));
   $controller->redirect();


the code base controller (controller.php) is

code: select all

defined('_jexec') or die;
   
   class questauditcontroller extends jcontrollerlegacy
   {
      protected $default_view = 'questaudits';
   
      function __construct()
      {
         parent::__construct();
      }
     
      public function display($cachable = false, $urlparams = false)
      {
         require_once jpath_component.'/helpers/questaudit.php';
      
         $view = $this->input->get('view', 'questaudits');
         $layout = $this->input->get('layout', 'default');
         $id = $this->input->getint('id');
         //die("view {$view}, layout {$layout} , id {$id}");

         parent::display($cachable);
      }
   }

i found issue.
joomla 3 (and 2.5) have 2 types of controllers.
the master controller (admin/controller.php) used whenever going display page.
then have subcontrollers tasks not require displaying (for example updating database record). subcontroller used update record, pass result master controller used display page end user.

when call master controller making call task normal. example :
option=com_questaudits&view=test&task=runtest
the above use master controller , run function runtest inside master controller , display results in test view.

when want make call subcontroller make call task in following format : controller.function
for example :
option=com_questaudits&view=test&task=testing.runtest
this load teh subcontroller testing , run function runtest





Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support