src/Helpers/TemplateHelper.php
public static function getSmartyTemplate()
    {
        $smarty = new \SmartyBC;
        $useTheme = !defined('OPENBIZ_USE_THEME') ? 0 : OPENBIZ_USE_THEME;
        if ($useTheme) {
            $theme = Openbizx::$app->getCurrentTheme();
            $themePath = $theme;    // Openbizx::$app->getConfiguration()->GetThemePath($theme);
            if (is_dir(OPENBIZ_THEME_PATH . "/" . $themePath . "/template")) {
                $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/template";
            } else {
                $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/templates";
            }
            $smarty->setTemplateDir($templateRoot);           
            $compileDir = defined('OPENBIZ_SMARTY_CPL_PATH') ? OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath : $templateRoot . "/cpl";
            $smarty->setCompileDir($compileDir);            
            $smarty->setConfigDir($templateRoot . "/cfg");            
            $smarty->config_load('tpl.conf');
        } else {
            if (defined('SMARTY_TPL_PATH')) {
                $smarty->setTemplateDir( SMARTY_TPL_PATH );
            }
            if (defined('OPENBIZ_SMARTY_CPL_PATH')) {
                $smarty->setCompileDir( OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath );
            }
            if (defined('SMARTY_CFG_PATH')) {
                $smarty->setConfigDir( SMARTY_CFG_PATH );
            }
        }
        
        if (!is_dir($smarty->compile_dir)) {
            mkdir($smarty->compile_dir, 0777);
        }
        
        // load the config file which has the images and css url defined
        $smarty->assign('app_url', OPENBIZ_APP_URL);
        $smarty->assign('app_index', OPENBIZ_APP_INDEX_URL);
        $smarty->assign('js_url', OPENBIZ_JS_URL);
        $smarty->assign('css_url', OPENBIZ_THEME_URL . "/" . $theme . "/css");
        $smarty->assign('resource_url', OPENBIZ_RESOURCE_URL);
        $smarty->assign('resource_php', OPENBIZ_RESOURCE_PHP);
        $smarty->assign('theme_js_url', OPENBIZ_THEME_URL . "/" . $theme . "/js");
        $smarty->assign('theme_url', OPENBIZ_THEME_URL . "/" . $theme);
        $smarty->assign('image_url', OPENBIZ_THEME_URL . "/" . $theme . "/images");
        $smarty->assign('lang', strtolower(I18n::getCurrentLangCode()));
        $smarty->assign('lang_name', I18n::getCurrentLangCode());

        return $smarty;
    }
public static function getSmartyTemplate()
    {
        $smarty = new \SmartyBC;
        $useTheme = !defined('OPENBIZ_USE_THEME') ? 0 : OPENBIZ_USE_THEME;
        if ($useTheme) {
            $theme = Openbizx::$app->getCurrentTheme();
            $themePath = $theme;    // Openbizx::$app->getConfiguration()->GetThemePath($theme);
            if (is_dir(OPENBIZ_THEME_PATH . "/" . $themePath . "/template")) {
                $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/template";
            } else {
                $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/templates";
            }
            $smarty->setTemplateDir($templateRoot);           
            $compileDir = defined('OPENBIZ_SMARTY_CPL_PATH') ? OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath : $templateRoot . "/cpl";
            $smarty->setCompileDir($compileDir);            
            $smarty->setConfigDir($templateRoot . "/cfg");            
            $smarty->config_load('tpl.conf');
        } else {
            if (defined('SMARTY_TPL_PATH')) {
                $smarty->setTemplateDir( SMARTY_TPL_PATH );
            }
            if (defined('OPENBIZ_SMARTY_CPL_PATH')) {
                $smarty->setCompileDir( OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath );
            }
            if (defined('SMARTY_CFG_PATH')) {
                $smarty->setConfigDir( SMARTY_CFG_PATH );
            }
        }
        
        if (!is_dir($smarty->compile_dir)) {
            mkdir($smarty->compile_dir, 0777);
        }
        
        // load the config file which has the images and css url defined
        $smarty->assign('app_url', OPENBIZ_APP_URL);
        $smarty->assign('app_index', OPENBIZ_APP_INDEX_URL);
        $smarty->assign('js_url', OPENBIZ_JS_URL);
        $smarty->assign('css_url', OPENBIZ_THEME_URL . "/" . $theme . "/css");
        $smarty->assign('resource_url', OPENBIZ_RESOURCE_URL);
        $smarty->assign('resource_php', OPENBIZ_RESOURCE_PHP);
        $smarty->assign('theme_js_url', OPENBIZ_THEME_URL . "/" . $theme . "/js");
        $smarty->assign('theme_url', OPENBIZ_THEME_URL . "/" . $theme);
        $smarty->assign('image_url', OPENBIZ_THEME_URL . "/" . $theme . "/images");
        $smarty->assign('lang', strtolower(I18n::getCurrentLangCode()));
        $smarty->assign('lang_name', I18n::getCurrentLangCode());

        return $smarty;
    }
Get smarty template
@return Smarty smarty object