> **BlogEase**是[火端网络](http://www.huoduan.com)开发的一款免费开源的PHP博客系统。官方网站:[http://www.blogease.com](http://www.blogease.com)
![](https://box.kancloud.cn/df9eaa31f36e084f8e3f6e28cc1818d5_204x40.png)
## 测试代码高亮
~~~php
class View{
private $template_dir;
private $data = array();
public function __construct($template_dir){
$this->template_dir = $template_dir?$template_dir:CORE_PATH.'view'.DS;
}
public function render($tempalte_name){
$file = $this->template_dir.$tempalte_name;
if(!file_exists($file)) _error('Error: "'.$file.'" is not exists!');
@ob_start();
$this->data = do_filter('view_data',$this->data);
extract($this->data, EXTR_SKIP);
$_view_obj = & $this;
include $file;
return ob_get_clean();
}
public function assign($name, $value = ''){
if(is_array($name)){
$this->data = array_merge($this->data, $name);
}else{
if($name != '')$this->data[$name] = $value;
}
}
}
~~~