public function _include($attr, $content) { if (!empty($attr['file'])) { $file = "template/" . C("WEB_STYLE") . "/" . $attr['file']; if (is_file($file)) { $view = new ViewHd(); $view->fetch($file); return $view->getCompileContent(); } } }
public function _include($attr, $content, &$hd) { //替换常量 $const = get_defined_constants(true); foreach ($const['user'] as $k => $v) { $attr['file'] = str_replace($k, $v, $attr['file']); } //删除域名 $file = str_replace(__ROOT__ . '/', '', trim($attr['file'])); $view = new ViewHd(); $view->fetch($file); return file_get_contents($view->compileFile); }
/** * 加载模板文件 * @param $attr * @param $content * @return string */ public function _load($attr, $content) { if (!isset($attr['file'])) { halt('load 模板标签必须有value属性', false); //load标签必须有file属性 } $const = print_const(false, true); foreach ($const as $k => $v) { $attr['file'] = str_replace($k, $v, $attr['file']); } $file = str_replace(__ROOT__ . '/', '', trim($attr['file'])); $view = new ViewHd(); $view->fetch($file); return $view->getCompileContent(); }
/** * 加载模板文件 * @param $attr * @param $content * @return string */ public function _include($attr, $content) { if (!isset($attr['file'])) { return; } $const = print_const(false, true); foreach ($const as $k => $v) { $attr['file'] = str_replace($k, $v, $attr['file']); } $file = str_replace(__ROOT__ . '/', '', trim($attr['file'])); $view = new ViewHd(); $view->fetch($file); return $view->getCompileContent(); }