Closed wonderfan closed 9 years ago
The main characteristics of front controller class:
The routers are declared in the xml by const XML_STORE_ROUTERS_PATH = 'web/routers';
The match process:
How to find the controller class:
public function getControllerFileName($realModule, $controller)
{
$parts = explode('_', $realModule);
$realModule = implode('_', array_splice($parts, 0, 2));
$file = Mage::getModuleDir('controllers', $realModule);
if (count($parts)) {
$file .= DS . implode(DS, $parts);
}
$file .= DS.uc_words($controller, DS).'Controller.php';
return $file;
}
The path is module path plus controller directory plus TestController.php
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
public static function getControllerInstance($class, $request, $response, array $invokeArgs = array())
{
return new $class($request, $response, $invokeArgs);
}
The application object is associated with front controller class