/** * Set initial settings and call init() * * @param array $settings */ function __construct($settings = array()) { $this->settings = $settings; $layout = Zend_Layout::getMvcInstance(); $this->view = $layout->getView(); // Add module paths to view scripts $this->view->addBasePath(ZfApplication::$_base_path . "/app/Flex/views", "Flex_View"); $this->view->addScriptPath($layout->getLayoutPath() . "default/templates/Flex/"); $this->view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/Flex/"); $this->init(); }
/** * Render a hook's content * * @param string $name template to use * @param string $module module to fetch template from * @param string $controller controller to fetch template from, defaults to 'hooks' * * @return string Rendered content * */ public function render($name, $module, $controller = "hooks") { $layout = Zend_Layout::getMvcInstance(); // Reset view script paths $this->view->setScriptPath(null); // Build new ones for hooks $this->view->addBasePath(ZfApplication::$_base_path . "/app/{$module}/views", $module . "_View"); //$this->view->addScriptPath(ZfApplication::$_base_path."/app/$module/Views/"); $this->view->addScriptPath($layout->getLayoutPath() . "default/templates/{$module}"); $this->view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/{$module}"); return $this->view->render($controller . "/" . $name); }
/** * Zend_View compatibility. Add the templates dir * * @see View/Zend_View_Abstract::addBasePath() * @return Ext_View_Smarty */ public function addBasePath($path, $classPrefix = 'Zend_View') { parent::addBasePath($path, $classPrefix); $this->addScriptPath($path . '/templates'); $this->addTemplateDir($path . '/templates/static'); return $this; }
/** * Reset the view's script paths and set new ones for use in the block * * @param Zend_View_Abstract $view */ private function resetViewScripts(Zend_View_Abstract $view) { $layout = Zend_Layout::getMvcInstance(); // Reset view script paths $view->setScriptPath(null); $module = ucfirst($this->module); // Build new ones for blocks $view->addBasePath(ZfApplication::$_base_path . "/app/{$module}/views", $module . "_View"); $view->addScriptPath(ZfApplication::$_base_path . "/app/{$module}/views/scripts/blocks"); $view->addScriptPath($layout->getLayoutPath() . "default/templates/blocks"); $view->addScriptPath($layout->getLayoutPath() . "default/templates/{$module}/blocks"); $view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/blocks"); $view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/{$module}/blocks"); }