/** * 取得模板显示变量的值 * @access protected * @param string $name 模板显示变量 * @return mixed */ public function get($name = '') { if ($this->view == null) { $this->view = new \Think\View(); } return $this->view->get($name); }
/** * 取得模板显示变量的值 * * @access protected * @param string $name * 模板显示变量 * @return mixed */ public function get($name = '') { return $this->view->get($name); }
/** * 处理显示模板内容,处理不需要是数据源(或者自己带有数据源)模板的现实 */ public static function output() { $agrs = func_get_args(); //有缓存就直接读缓存 if ($htmlStr = self::getCacheHandler()->getCache('Tag' . md5(Tag::getInt(0, 0, $agrs)))) { return $htmlStr; } extract(view::get()); //将模板对象吊出来 $content = stripslashes(sf::getModel("templates", Tag::getInt(0, 0, $agrs))->getContent()); //取得模板内容 ob_start(); eval("?>{$content}<?php "); $htmlStr = ob_get_contents(); ob_end_clean(); //将内容写到缓存中 self::getCacheHandler()->setCache('Tag' . md5(Tag::getInt(0, 0, $agrs)), $htmlStr); return $htmlStr; }