(Yaf >=1.0.0)
Yaf_View_Simple::__construct — Constructor of Yaf_View_Simple
Yaf_View_Simple is the default and only view engine Yaf supports out of the box. An instance is created automatically by the Yaf_Dispatcher when the application starts; instantiating it directly is only needed to render templates outside of the dispatch flow.
The template_dir argument must point to an existing directory containing the view scripts; it becomes the script path of the view and can later be changed with Yaf_View_Simple::setScriptPath().
template_dirThe directory where the template scripts are stored.
optionsOptional view options as an array. Reserved for custom view engine implementations; the built-in engine accepts but does not use it.
No value is returned.
Example #1 Yaf_View_Simple::__construct() example
<?php
define("TEMPLATE_DIRECTORY", APPLICATION_PATH . '/views');
$view = new Yaf_View_Simple(TEMPLATE_DIRECTORY);
$view->assign("name", "world");
echo $view->render("greeting.phtml");
?>