Exemplo n.º 1
0
 /**
  * @param null $path
  * @param null $prefix
  * @param array $options
  */
 public function initView($path = null, $prefix = null, array $options = array())
 {
     if (null === $this->view) {
         $view = new Pimcore_View();
         $view->setRequest($this->getRequest());
         $view->addHelperPath(PIMCORE_PATH . "/lib/Pimcore/View/Helper", "Pimcore_View_Helper_");
         $this->setView($view);
     }
     parent::initView($path, $prefix, $options);
     $this->setViewSuffix(Pimcore_View::getViewScriptSuffix());
     // this is very important, the initView could be called multiple times.
     // if we add the path on every call, we have big performance issues.
     if ($this->isInitialized) {
         return;
     }
     $this->isInitialized = true;
     $paths = $this->view->getScriptPaths();
     // script pathes for layout path
     foreach (array_reverse($paths) as $path) {
         $path = str_replace("\\", "/", $path);
         if (!in_array($path, $paths)) {
             $this->view->addScriptPath($path);
         }
         $path = str_replace("/scripts", "/layouts", $path);
         if (!in_array($path, $paths)) {
             $this->view->addScriptPath($path);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @param null $path
  * @param null $prefix
  * @param array $options
  */
 public function initView($path = null, $prefix = null, array $options = array())
 {
     if (null === $this->view) {
         $view = new Pimcore_View();
         $view->setRequest($this->getRequest());
         $view->addHelperPath(PIMCORE_PATH . "/lib/Pimcore/View/Helper", "Pimcore_View_Helper_");
         $this->setView($view);
     }
     parent::initView($path, $prefix, $options);
     // script pathes for layout path
     foreach (array_reverse($this->view->getScriptPaths()) as $path) {
         $path = str_replace("\\", "/", $path);
         $this->view->addScriptPath($path);
         $this->view->addScriptPath(str_replace("/scripts", "/layouts", $path));
     }
     $this->setViewSuffix(Pimcore_View::getViewScriptSuffix());
 }
Exemplo n.º 3
0
 protected function initCustomView()
 {
     $viewHelper = Zend_Controller_Action_HelperBroker::getExistingHelper("ViewRenderer");
     $view = new Pimcore_View();
     // script pathes
     foreach ($viewHelper->view->getScriptPaths() as $path) {
         $view->addScriptPath($path);
         $view->addScriptPath(str_replace(DIRECTORY_SEPARATOR . "scripts", DIRECTORY_SEPARATOR . "layouts", $path));
     }
     // view helper
     foreach ($viewHelper->view->getHelperPaths() as $prefix => $path) {
         $view->addHelperPath($path, $prefix);
     }
     $view->addHelperPath(PIMCORE_PATH . "/lib/Pimcore/View/Helper", "Pimcore_View_Helper_");
     // add helper to controller
     $viewHelper->setView($view);
     $viewHelper->setViewSuffix($this->getViewSuffix());
     Zend_Controller_Action_HelperBroker::addHelper($viewHelper);
     $this->view = $view;
     Zend_Registry::set("pimcore_custom_view", true);
 }