<?php
//index.php
Mage::run()
// App/Mage.php
function run(){
self::app()->getFrontController()->dispatch();
}
//Mage_Core_Model_App
public function getFrontController()
{
$this->_initFrontController();
}
protected function _initFrontController()
{
$this->_frontController = new Mage_Core_Controller_Varien_Front();
$this->_frontController->init();
}
//Mage_Core_Controller_Varien_Front
public function init()
{
$routersInfo = Mage::app()->getStore()->getConfig(self::XML_STORE_ROUTERS_PATH);
// adding Mage_Core_Controller_Varien_Router_Standard and Mage_Core_Controller_Varien_Router_Admin routers
foreach ($routersInfo as $routerCode => $routerInfo)
{
$this->addRouter($routerCode, $router);
}
// Add default router at the last
$default = new Mage_Core_Controller_Varien_Router_Default();
$this->addRouter('default', $default);
}
public function dispatch()
{
// $router is object of Mage_Core_Controller_Varien_Router_Standard
$router->match($this->getRequest()
}
//Mage_Core_Controller_Varien_Router_Standard
public function match(Zend_Controller_Request_Http $request)
{
$action = $request->getActionName();
// $controllerInstance is object of custom controller
$controllerInstance = new $controllerClassName($request, $front->getResponse());
$controllerInstance->dispatch($action);
}
?>