public function init() { // Just in cas something goes wrong before the end // @todo replace with a setTemplate() in t41\Exception View::setTemplate('default.html'); // get page identifiers (module, controller and action) Layout::$module = $this->_getParam('module'); Layout::$controller = $this->_getParam('controller'); Layout::$action = $this->_getParam('action'); // provide controller with basic information about the current module foreach (Module::getConfig() as $vendor => $modules) { foreach ($modules as $key => $module) { if (isset($module['controller']) && Layout::$module == $module['controller']['base']) { $this->_module = 'app/' . $vendor . '/' . $key; Layout::$vendor = $vendor; Layout::$moduleKey = $key; $resource = Layout::$controller; if (Layout::$action) { $resource .= '/' . Layout::$action; } if (isset($module['controller']['items'])) { foreach ($module['controller']['items'] as $controller) { if ($this->_getCurrentItem($resource, $controller) == true) { break; } } } if (isset($module['controllers_extends'])) { foreach ($module['controllers_extends'] as $controller) { if ($this->_getCurrentItem($resource, $controller['items']) == true) { break; } } } break; } } } }