/** * Get the Smarty instance and create if not exists * @return Smarty */ public static function getSmarty() { if (self::$_smarty === NULL) { # Setup smarty config require_once GWF_SMARTY_PATH; $smarty = new Smarty(); $smarty->setTemplateDir(GWF_WWW_PATH . 'tpl/'); $dir = rtrim(GWF_SMARTY_DIRS, '/') . '/'; $smarty->setCompileDir($dir . 'tplc'); $smarty->setCacheDir($dir . 'cache'); $smarty->setConfigDir($dir . 'cfg'); $smarty->addPluginsDir(GWF_CORE_PATH . 'inc/smartyplugins'); # Assign common template vars // $smarty->assign('db', gdo_db()); $smarty->assign('gwff', GWF_SmartyFile::instance()); $smarty->assign('gwmm', GWF_SmartyModuleMethod::instance()); $smarty->assign('root', GWF_WEB_ROOT); $smarty->assign('core', GWF_CORE_PATH); $smarty->assign('iconset', GWF_ICON_SET); $smarty->assign('design', self::getDesign()); self::$_smarty = $smarty; } return self::$_smarty; }
public static function init() { self::$instance = new self(); }