Example #1
0
 /**
  * @param string $basePath Application's base path ending with DIRECTORY_SEPARATOR
  * @param string $theme
  * @param \Skully\Application $app
  * @param array $additionalPluginsDir
  * @param int $caching
  */
 public function __construct($basePath, $theme = 'default', $app = null, $additionalPluginsDir = array(), $caching = 1)
 {
     $appName = $app->getAppName();
     $this->app = $app;
     $this->smarty = new \Smarty();
     $this->smarty->caching = $caching;
     $this->caching = $caching;
     $this->smarty->setCompileDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'templates_c')) . DIRECTORY_SEPARATOR);
     $this->smarty->setConfigDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'configs')) . DIRECTORY_SEPARATOR);
     $this->smarty->setCacheDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'cache')));
     $dirs = $this->app->getTheme()->getDirs();
     foreach ($dirs as $key => $dir) {
         if ($key == 'main' || $key == 'default') {
             $this->addTemplateDir($dir . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR . 'views', $key);
         } else {
             $this->addTemplateDir($dir . DIRECTORY_SEPARATOR . 'views', $key);
         }
     }
     $plugins = array_merge($additionalPluginsDir, array($this->app->getRealpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR, $this->app->getRealpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'Library' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR));
     $this->setPluginsDir($plugins);
 }