Beispiel #1
0
 function __construct($main_tpl = '', $assing_tpl = array(), $output_type = false, $temp_type = false)
 {
     // 輸出樣板路徑以外的檔案
     switch ($temp_type) {
         case 2:
             $temp_router = '';
             break;
         case 1:
             $temp_router = CORE::$admin_temp;
             break;
         default:
             $temp_router = CORE::$temp;
             if (!$output_type) {
                 SCHEMA::output(true);
             }
             # 輸出結構化標記
             break;
     }
     self::$tpl = new TemplatePower($temp_router . $main_tpl);
     // 註冊主要樣板
     // 附加樣板 (陣列輸入)
     if (is_array($assing_tpl) && count($assing_tpl) > 0) {
         foreach ($assing_tpl as $tpl_title => $tpl_path) {
             self::$tpl->assignInclude($tpl_title, $temp_router . $tpl_path);
         }
     }
     self::$tpl->prepare();
     // 建立輸出功能
     if (is_array(self::$parameter) && count(self::$parameter) > 0) {
         foreach (self::$parameter as $tpl_key => $tpl_array) {
             $tpl_type = array_keys($tpl_array);
             $tpl_value = $tpl_array[$tpl_type[0]];
             switch ($tpl_type[0]) {
                 case 0:
                     self::assign_do($tpl_value, false);
                     break;
                 case 1:
                     self::block_do($tpl_value, false);
                     break;
                 case 2:
                     self::block_do($tpl_value, true);
                     break;
                 case 3:
                     self::assign_do($tpl_value, true);
                     break;
             }
         }
     }
     // 輸出
     if (!$output_type) {
         if (CORE::$cfg["langfix"] == 'chs' && !CORE::$bgend) {
             self::$output = self::$tpl->getOutputContent();
             $output = BIG2GB::go(self::$output);
             echo self::noTransGo($output);
         } else {
             self::$tpl->printToScreen();
         }
         self::$parameter = array();
         exit;
     } else {
         self::$output = self::$tpl->getOutputContent();
     }
 }