template
来源:互联网 发布:国际象棋在线对弈软件 编辑:程序博客网 时间:2024/06/06 11:49
class TemplateLoader{ protected $_tplDir = 'templates/'; private $_mapVars = array(); public function __construct($options = array()) { foreach ($options as $k => $v) { $attr = '_' . $k; if (property_exists($this, $attr)) { $this->$attr = $v; } } } public function assign($name, $value) { $this->_mapVars[$name] = $value; } public function display($tpl) { extract($this->_mapVars); include $this->_tplDir . $tpl; } public function getDisplay($tpl, $vals = array()) { extract(array_merge($this->_mapVars, $vals)); // @attention maybe some wrong if already ob_start called before @ob_start(); include $this->_tplDir . $tpl; $displayInfo = ob_get_clean(); @ob_end_clean(); return $displayInfo; }}
0 0
- template
- Template
- template
- template
- template
- Template
- template
- template
- Template
- template
- Template
- template
- template
- Template
- template
- template
- Template
- template
- java(JDBC连接数据库)[完整版封装]
- 【随行笔记】与网络编程有关
- 高并发系统设计之开放平台API接口调用频率控制系统
- TCP/IP状态变迁
- linux使用vi编辑修改文件内容的基本方法
- template
- 3.决策树Decision Tree
- A - Accurately Say "CocaCola"! --- (first qualifying)
- [HDU 2191]悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
- 【数据库】查询语句
- Android实战之 万能的接口回调
- UVA 127 ``Accordian'' Patience
- 7月27日--爬虫心得
- FZU 2168 防守阵地 I(公式推导)(经典)(中等)