public function preDispatch() { App_Main::getModel('core/url_rewrite')->rewrite(); //Initialize the display singleton prior to loading layout and initializing controllers App_Main::getDesign(); return $this; }
/** * Load the layout for the design area * The mehotd will load layout.xml the theme directory and blocks will be initialized * * @return Core_Model_Layout */ public function loadLayoutConfig() { $this->_layoutConfigFile = App_Main::getDesign()->getLayoutFilename('layout.xml'); if (!file_exists($this->_layoutConfigFile)) { App_Main::throwException('Layout config file not found. Cannot continue'); exit; } $this->_blocks = array(); $this->_elementClass = App_Main::getModelClassName('core/layout_element'); $this->setXml(simplexml_load_file($this->_layoutConfigFile, $this->_elementClass)->default->block); $this->generateBlocks(); return $this; }
protected function _preDispatch() { //set the area in the design model $design = App_Main::getDesign()->setArea($this->_currentArea); $website = $this->_getWebsite(); $namespace = $this->getLayout()->getArea(); App_Main::getSingleton('core/session', array('name' => $this->_currentArea))->start(); //load the website based configs only on frontend if ($this->_currentArea == 'frontend') { $website->loadFromRequestUrl(); //switch the theme based on website's theme if configured if ($website->getTheme() != $design->getTheme() && !$design->isThemeLocked()) { $design->setTheme($website->getTheme()); } if ($this->_getWebsite()->getConfig('session-log-visitors')) { App_Main::getSingleton('visitor/visitor')->initByRequest(); } } //set the theme from request or session if ($this->getRequest()->getParam('_theme') || $this->_getSession()->getCustomTheme()) { if ($theme = $this->getRequest()->getParam('_theme')) { $this->_getSession()->setCustomTheme($theme); } else { $theme = $this->_getSession()->getCustomTheme(); } $design->setTheme($theme)->lockTheme(); } $this->loadLayout(); //@#ToDO update layout for the current request $this->_updatelayout(); //init translator if ($this->_currentArea == 'frontend' && $this->_getWebsite()->getConfig('fontend_translation_enabled')) { App_Main::getTranslator()->init($this->_currentArea); } return $this; }
/** * Get url of skins files, Url is generated based on the current theme and area * * @param string file * @param array parameters * @return string */ public function getSkinUrl($file = null, array $params = array()) { return App_Main::getDesign()->getSkinUrl($file, $params); }
/** * Loading current theme translation * * @return Core_Model_Translate */ protected function _loadThemeTranslation($forceReload = false) { $this->getTranslate()->addTranslation(App_Main::getDesign()->getLocaleFileName(false)); return $this; }
/** * Set the theme for the layout * @param string $theme * @return Page_Block_Html */ public function setTheme($theme) { App_Main::getDesign()->setTheme($theme); return $this; }
/** * Render block */ public function renderView() { $this->setScriptPath(App_Main::getBaseDir('design')); //$params = array('_relative'=>true); $params = array(); if ($area = $this->getArea()) { $params['_area'] = $area; } $templateName = App_Main::getDesign()->getTemplateFilename($this->getTemplate(), $params); $html = $this->fetchView($templateName); return $html; }