Yaf_View_Simple::setScriptPath
PHP function
Edit on GitHub ✎
(Yaf >=1.0.0)
Set the template directory
Description
Yaf_View_Simple::setScriptPath(string $template_dir): Yaf_View_Simple
Sets the directory in which templates are looked up.
Parameters
template_dirThe directory where the template scripts are stored.
Return Values
Returns the view instance, or false if template_dir is not an absolute path.
Examples
Yaf_View_Simple::setScriptPath example
php
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
/* render templates from another directory */
$this->getView()->setScriptPath(APPLICATION_PATH . "/modules/admin/views");
$this->getView()->display("dashboard/index.phtml");
return false; // we rendered ourselves, skip auto-rendering
}
}
?>See Also
Yaf_View_Simple::getScriptPath