• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call another controller inside action?

#1
[eluser]tkrop[/eluser]
I'm in the process of converting a website from our custom framework to CodeIgniter. Our framework basically returns an ActionResult from every controller action, which can be converted to a string.

This is the situation:

Code:
function ControllerAction($route) {
    $subcontrollerRef = $route->object;
    $page = $route->page;
    $subpage = $route->subpage;

    $controller = ControllerFactory::getController($subcontrollerRef);
    return $controller->$page($route); //dont know if this is syntactically correct, but this is what's going on. The $page function inside the $controller var, is the 'action' name that needs to be executed/returned.
}

Can this be done with CodeIgniter?

#2
[eluser]Peter Drinnan[/eluser]
I think this may help.

I more-or-less went through the same painful process as you in converting an exiting pile of proprietary framework files into CI compatible files. Had to deal with content manager block modules by adding a SetInstance() function to Base5.php which allowed me to transfer control to subcontroller blocks, then restore it to the parent (page) using getInstance(). I didn't bother with Base4.php because I never use PHP 4.

Hope this helps ...

http://ellislab.com/forums/viewthread/161260/


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.