(Yaf >=1.0.0)
Yaf_View_Simple::setScriptPath — 设置模板目录
template_dir存放模板脚本的目录。
返回视图实例,如果 template_dir 不是绝对路径则返回 false。
示例 #1 Yaf_View_Simple::setScriptPath() 示例
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
/* 从另一个目录渲染模板 */
$this->getView()->setScriptPath(APPLICATION_PATH . "/modules/admin/views");
$this->getView()->display("dashboard/index.phtml");
return false; // 已自行渲染,跳过自动渲染
}
}
?>