public function display($tpl) { global $_F; $this->tpl_parser->display($tpl); if ($_F['debug'] && !$_F['in_ajax']) { echo FView::getDebugInfo(); } }
public function display($tpl) { global $_F; if (isset($_F['var'])) { extract($_F['var']); } if ($tpl[0] == '/' || $tpl[1] == ':') { include $tpl; exit; } else { $tplFile = F_APP_ROOT . 'tpl/' . $tpl; } if (file_exists($tplFile)) { include $tplFile; } elseif (file_exists($tplFile . ".tpl.php")) { include $tplFile . ".tpl.php"; } else { echo "模版文件不存在!" . $tpl . ".tpl.php"; } if ($_F['debug'] && !$_F['in_ajax']) { echo FView::getDebugInfo(); } exit; }
public function load($tpl) { global $_F; $tpl = $this->getDefaultTpl($tpl); $this->set('_F', $_F); $view_compress = FConfig::get('global.output_compress'); $contents = $this->fetch($tpl); if ($view_compress) { // 会有 http:// 这样的都替换没了 $contents = preg_replace('#^\\s*/' . '/.*$#im', '', $contents); $contents = preg_replace('#<!--.+?-->#si', '', $contents); $contents = preg_replace('/^\\s+/im', '', $contents); $contents = preg_replace('/>\\s+/im', '>', $contents); $contents = preg_replace('/\\s*([{};,])\\s*/im', '\\1', $contents); // $contents = preg_replace('/\s+/im', ' ', $contents); } if ($_F['debug'] && !$_F['in_ajax']) { $contents .= FView::getDebugInfo(); } return $contents; }