setPluginsDir example

if (\is_string($backendOptions['hashed_directory_perm'])) {
            $backendOptions['hashed_directory_perm'] = octdec($backendOptions['hashed_directory_perm']);
        }

        $this->_file_perms = $backendOptions['cache_file_perm'];
        $this->_dir_perms = $backendOptions['hashed_directory_perm'];

        // Set default dirs         $this->setTemplateDir('.' . DS . 'templates' . DS)
            ->setCompileDir('.' . DS . 'templates_c' . DS)
            ->setPluginsDir([\dirname(__FILE__) . '/Plugins/', SMARTY_PLUGINS_DIR])
            ->setCacheDir('.' . DS . 'cache' . DS)
            ->setConfigDir('.' . DS . 'configs' . DS);

        $this->debug_tpl = 'file:' . SMARTY_DIR . '/debug.tpl';

        $this->setOptions($options);
        $this->setCharset();
    }

    /** * Technically smarty security is enabled, if a security policy is set for the template manager instance. The * security policy holds a reference to the template manager instance. When cloning the template manager, the * reference of the security_policy to the Smarty instance has be updated to the new cloned Smarty instance. * * Without doing this, every self::fetch() after a directory was added with self::addTemplateDir(), would lead to a * SmartyException with message 'directory [...] not allowed by security setting'. This is because * the security_policy still holds a reference to the old Smarty instance that does not know this new directories * as template sources. * * The security_policy is also cloned so other instances of the Enlight_Template_Manager do not get affected. */
public function __construct()
    {
        // selfpointer needed by some other class methods         $this->smarty = $this;
        if (is_callable('mb_internal_encoding')) {
            mb_internal_encoding(Smarty::$_CHARSET);
        }
        $this->start_time = microtime(true);
        // set default dirs         $this->setTemplateDir('.' . DS . 'templates' . DS)
            ->setCompileDir('.' . DS . 'templates_c' . DS)
            ->setPluginsDir(SMARTY_PLUGINS_DIR)
            ->setCacheDir('.' . DS . 'cache' . DS)
            ->setConfigDir('.' . DS . 'configs' . DS);

        $this->debug_tpl = 'file:' . dirname(__FILE__) . '/debug.tpl';
        if (isset($_SERVER['SCRIPT_NAME'])) {
            $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
        }
    }


    /** * Class destructor */
Home | Imprint | This part of the site doesn't use cookies.