基于phplib 实现的 View 代码如下:
<?php
/**
* Yogurt : MVC Development Framework with PHP<http://www.yogurtframework.com/>
* phplib view class of yogurt framework.
*
* @author rick <[email protected]>
* @copyright Copyright (c)2009-2013
* @link http://www.yogurtframework.com
* @license http://www.yogurtframework.com/license/
* @filesource yogurt4php/core/view/ViewPhplib.php
* @since Yogurt v 0.9
* @version $3.0
*/
require_once (LIB_PATH. 'phplib-7.4a/php/template.php');
class ViewPhplib extends Template implements IView {
/**
* construct of View
* init smarty
*/
public function __construct() {
parent::Template();
}
/**
*
* @param unknown $key
* @param unknown $value
*/
public function viewAssign($key, $value=null) {
$this->set_var($key, $value);
}
/**
*
* @param unknown $tpl
* @param unknown $options
*/
public function viewDisplay($tpl, $options){
$this->set_root($options["tpl_dir"]);
$this->filename($tpl);
}
}
?>