(Yaf >=1.0.0)
Yaf_View_Simple::display — Render and store a template in the response
Renders a template and appends the result to the Yaf_Response_Abstract body.
Note:
Unlike Yaf_View_Simple::render(), the result is not returned but stored in the response, and Yaf_Application sends it when the response is emitted.
tplThe path to the template, relative to the template directory set by Yaf_View_Simple::setScriptPath() or application.view.directory.
varsOptional variables to assign for this template only; they override assigned variables with the same name.
Example #1 Yaf_View_Simple::display() example
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
$this->getView()->assign("title", "My Homepage");
/* render index/index.phtml and store the result
* in the response body */
$this->getView()->display("index/index.phtml");
return false; // we rendered ourselves, skip auto-rendering
}
}
?>Example #2 Template example
<html>
<head>
<title><?php echo $title; ?></title>
</head>
</html>