Smarty::__construct PHP Method

__construct() public method

Initialize new Smarty object
public __construct ( )
    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']);
        }
    }

Usage Example

 /**
  * Construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->JSRMS = new JSRMS();
     $this->JSRMS->requireResource('system');
     $this->muteExpectedErrors();
     $this->setCacheDir(SYSTEM_ROOT . '/classes/smarty/cache/');
     $this->setCompileDir(SYSTEM_ROOT . '/classes/smarty/templates_c/');
     $this->setTemplateDir(SYSTEM_ROOT . '/view/');
     $this->registerObject('Router', Router::getInstance(), array('build'), false);
     $this->registerObject('L10N', System::getLanguage(), array('_'), false);
     $this->assign('LoggedIn', System::getUser() != NULL);
     $this->assign('User', System::getUser());
     $this->assign('Navigation', Navigation::$elements);
     $this->assign('LangStrings', System::getLanguage()->getAllStrings());
     // Configuration
     $this->assign('HTTP_BASEDIR', System::getBaseURL());
     $this->assign('MOD_REWRITE', MOD_REWRITE);
     $this->assign('MAX_UPLOAD_SIZE', Utils::maxUploadSize());
     if (System::getSession()->getData('successMsg', '') != '') {
         $this->assign('successMsg', System::getSession()->getData('successMsg', ''));
         System::getSession()->setData('successMsg', '');
     }
     if (System::getSession()->getData('errorMsg', '') != '') {
         $this->assign('errorMsg', System::getSession()->getData('errorMsg', ''));
         System::getSession()->setData('errorMsg', '');
     }
     if (System::getSession()->getData('infoMsg', '') != '') {
         $this->assign('infoMsg', System::getSession()->getData('infoMsg', ''));
         System::getSession()->setData('infoMsg', '');
     }
 }
All Usage Examples Of Smarty::__construct