Pimcore\View::getViewScriptSuffix PHP Method

getViewScriptSuffix() public static method

public static getViewScriptSuffix ( ) : string
return string
    public static function getViewScriptSuffix()
    {
        // default is php
        $viewSuffix = "php";
        // custom view suffixes are only available for the frontend module (website)
        if (\Zend_Controller_Front::getInstance()->getRequest()->getModuleName() == PIMCORE_FRONTEND_MODULE) {
            $customViewSuffix = Config::getSystemConfig()->general->viewSuffix;
            if (!empty($customViewSuffix)) {
                $viewSuffix = $customViewSuffix;
            }
        }
        return $viewSuffix;
    }

Usage Example

Example #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 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(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);
         }
     }
 }
All Usage Examples Of Pimcore\View::getViewScriptSuffix