go back
How do I call a Joomla Controller from another Controller?
Answer
Joomla MVC is a great way to seggregate your code into different functional units. Controllers have access to all their own resources but if you want to sidechain a controller to another controller there isn't really any function within the controller to call another controller. The best way call another controller is this way:
include_once(JPATH_COMPONENT . DS . 'controllers' . DS
.'ControllerName' . '.php');$controller = new ControllerName();
$controller->execute('task');
Include the controller just like you did in the main component, and then create a new one in memory, execute your task.
Hope this helps save someone time.
Category
Tags for this item
Most Popular Questions and Answers
- How do I embed HTML Forms, paypal, or video into my Content Articles?
- How do I Turn Off My Joomla WYSIWYG Editor?
- Where are the best free Joomla templates?
- Where are the best joomla catalog templates?
- Where are the best professional Joomla templates?
- Where can I find a joomla motorcycle web template?
- How do I call a Joomla Controller from another Controller?
- How Do I Get Started with My Core Package
- How do I add Google Adsense into Joomla?
- What Are Joomla Modules and Module Positions?