public function initView() { if ($this->view === null || !$this->view instanceof View) { $module = $this->getRequest()->getModuleName(); $paths = $this->getFrontController()->getControllerDirectory(); $modulePath = dirname($paths[$module]); $viewBaseDir = $modulePath . DIRECTORY_SEPARATOR . 'views'; $this->view = new View(array('basePath' => $viewBaseDir, 'encoding' => $this->defaultEncoding)); $this->view->setTheme(Application::getTheme()); $this->view->setModuleName($module); } return $this->view; }