Skip to main content

Q. What is the responsibility of the Front Controller?

Directly receive the request from the browser.
All requests call the function Mage_Core_Controller_Varien_Front::dispatch()
- URL rewriting process.
- Load the module and action controller corresponding with the requests through routers to process the requirements which are sent from clients.

Collect routers: admin, standard, default.
Use the function match() of routers to define the module and controller that are requested.
Call the function dispatch() of the controller requested.
Call the action requested.
- Return HTML for browser

$this->getResponse()->sendResponse(),
Call the function sendResponse() of Mage_Core_Model_Response_Http (extend from Zend_Controller_Response_Abstract).
Call the function sendHeaders() – use the header() function of PHP.
Call the function outputBody() to show the whole content of the body part:
echo implode(”, $this->_body);

By Michael Cristancho

I'm a Digital Commerce and Experience evangelist who enjoys engaging in thought-provoking conversation and mutual exploration. I am a strong believer that learning never ends, and each day brings another opportunity to grow as an individual and professional.