Esempio n. 1
0
 function preview_prefix($theme)
 {
     $theme_url = vmc::get_themes_m_host_url();
     $preview_prefix = $theme_url . '/' . $theme;
     return $preview_prefix;
 }
Esempio n. 2
0
 public final function page($view, $no_theme = false, $app_id = null)
 {
     $current_theme = vmc::singleton('mobile_theme_base')->get_default();
     $views = vmc::singleton('mobile_theme_base')->get_theme_views($current_theme);
     if ($no_theme == false && $current_theme) {
         $this->set_theme($current_theme);
         $this->pagedata['_MAIN_M_'] = $view;
         //强制替换
         $this->pagedata['_THEME_M_'] = vmc::get_themes_m_host_url() . '/' . $this->get_theme();
         //模版地址
         $tmpl_type = $this->get_tmpl();
         //模板文件类型
         $tmpl_file = $this->get_tmpl_file();
         //指定模板文件
         //没有指定模板文件
         if (!$tmpl_file || $tmpl_file == '') {
             if ($views[$tmpl_type] && $views[$tmpl_type][0]) {
                 $tmpl_file = $views[$tmpl_type][0]['value'];
                 //当没有指定模板文件时,找到的第一个模板文件即默认模板文件
             } else {
                 if ($tmpl_type == 'index') {
                     $tmpl_file = 'index.html';
                 } else {
                     $tmpl_file = 'default.html';
                 }
             }
         }
         //如果有模版,检测当前theme下是否有此模板
         $this->set_tmpl_main_app_id($app_id);
         $html = $this->fetch_tmpl($tmpl_file, $is_preview);
     } else {
         $html = $this->fetch($view, $app_id, $is_preview);
     }
     if (!$this->_response->get_header('Content-type', $header)) {
         $this->_response->set_header('Content-type', $this->contentType, true);
     }
     //如果没有定义Content-type,默认加text/html;charset=utf-8
     if (!$this->_response->get_header('Cache-Control', $header)) {
         ${$cache_control} = array();
         foreach ($this->__cachecontrol as $val) {
             $val = trim($val);
             if (empty($val)) {
                 continue;
             }
             $cache_control[] = $val;
         }
         $this->_response->set_header('Cache-Control', implode(',', $cache_control), true);
     }
     //如果没有定义Content-Control,使用系统配置
     $this->_response->set_body($html);
 }