Yaf_View_Simple::display
(Yaf >=1.0.0)
Render and store a template in the response
Description
Renders a template and appends the result to the Yaf_Response_Abstract body.
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.
Parameters
tplThe path to the template, relative to the template directory set by
Yaf_View_Simple::setScriptPathorapplication.view.directory.varsOptional variables to assign for this template only; they override assigned variables with the same name.
Return Values
Returns true on success, or false on failure.
Examples
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
}
}
?>Template example
<html>
<head>
<title><?php echo $title; ?></title>
</head>
</html>See Also
Yaf_View_Simple::renderYaf_View_Simple::assign