Smarty::setCacheDir PHP Method

setCacheDir() public method

Set cache directory
public setCacheDir ( string $cache_dir ) : Smarty
$cache_dir string directory to store cached templates in
return Smarty current Smarty instance for chaining
    public function setCacheDir($cache_dir)
    {
        $this->cache_dir = rtrim($cache_dir, '/\\') . DS;
        if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {
            Smarty::$_muted_directories[$this->cache_dir] = null;
        }
        return $this;
    }

Usage Example

Example #1
0
 /**
  * @param waSystem $system
  * @param array $options
  * @return waSmarty3View
  */
 public function __construct(waSystem $system, $options = array())
 {
     $this->smarty = new Smarty();
     parent::__construct($system, $options);
     if (isset($options['auto_literal'])) {
         $this->smarty->auto_literal = $options['auto_literal'];
     }
     if (isset($options['left_delimiter'])) {
         $this->smarty->left_delimiter = $options['left_delimiter'];
     }
     if (isset($options['right_delimiter'])) {
         $this->smarty->right_delimiter = $options['right_delimiter'];
     }
     $this->smarty->setTemplateDir(isset($options['template_dir']) ? $options['template_dir'] : $system->getAppPath());
     $this->smarty->setCompileDir(isset($options['compile_dir']) ? $options['compile_dir'] : $system->getAppCachePath('templates/compiled/'));
     $this->smarty->setCacheDir($system->getAppCachePath('templates/cache/'));
     if (ini_get('safe_mode')) {
         $this->smarty->use_sub_dirs = false;
     } else {
         $this->smarty->use_sub_dirs = true;
     }
     // not use
     //$this->smarty->setCompileCheck(wa()->getConfig()->isDebug()?true:false);
     $this->smarty->addPluginsDir($system->getConfig()->getPath('system') . '/vendors/smarty-plugins');
     $this->smarty->loadFilter('pre', 'translate');
 }
All Usage Examples Of Smarty::setCacheDir