Example #1
0
 private static function GetTemplate()
 {
     if (null == self::$mTemplate) {
         $smarty = new Smarty();
         $smarty->template_dir = TPL_TEMPLATE_DIR;
         $smarty->use_sub_dirs = defined('TPL_SUB_DIRS') ? TPL_SUB_DIRS : false;
         $smarty->compile_dir = TPL_COMPILED_DIR;
         $smarty->plugins_dir = isset($GLOBALS['CONFIG_TPLPLUGINS_DIRS']) ? $GLOBALS['CONFIG_TPLPLUGINS_DIRS'] : array('plugins', TPL_PLUGINS_DIR);
         $smarty->left_delimiter = '<{';
         $smarty->right_delimiter = '}>';
         $smarty->load_filter('output', 'cssholder');
         /* for convenience */
         //	global $current_user_id, $current_user_mobile, $current_user_active, $current_user_province, $current_user_city, $carrytime_beginning, $current_user_info, $current_header_type, $https_to_http;
         $current_error = $current_alert = '';
         if (!isset($https_to_http) || 0 >= $https_to_http) {
             $current_error = Session::GetInfo('error');
             $current_alert = Session::GetInfo('alert');
         }
         //$system_notice = array('type'=>'', 'message'=>'');
         $system_notice = 'null';
         if (!empty($current_alert)) {
             $system_notice = '{type:\'notice\',message:"' . $current_alert . '"}';
             //$system_notice = array('type'=>'info', 'message'=>$current_alert);
         } elseif (!empty($current_error)) {
             $system_notice = '{type:\'error\',message:"' . $current_error . '"}';
             //$system_notice = array('type'=>'error', 'message'=>$current_error);
         }
         if (!isset($current_header_type)) {
             $current_header_type = Utility::GetHeaderTypeByUrl();
         }
         /*   $smarty->assign('current_header_type', $current_header_type);
                     $smarty->assign('current_user_id', $current_user_id);
                     $smarty->assign('current_user_info', $current_user_info);
                     $smarty->assign('current_user_mobile', $current_user_mobile);
                     $smarty->assign('current_user_active', $current_user_active);
                     $smarty->assign('current_user_province', $current_user_province);
                     $smarty->assign('current_user_city', $current_user_city);
                     $smarty->assign('system_notice', $system_notice); 
         			$smarty->assign('carrytime_beginning', $carrytime_beginning);
                   */
         if (isset($_REQUEST['ajax'])) {
             $smarty->assign('ajax', $_REQUEST['ajax']);
         }
         //$smarty->assign( 'system_notice', json_encode($system_notice));
         /* end */
         self::$mTemplate = $smarty;
     }
     return self::$mTemplate;
 }