Abstract controller class for automatic templating.
Class declared in SYSPATH/classes/kohana/controller/template.php on line 11.
boolean
$auto_renderauto render template
Request
$requestRequest that created the controller
Response
$responseThe response that will be returned from controller
View
$templatepage template
Assigns the template View as the request response.
public function after()
{
if ($this->auto_render === TRUE)
{
$this->response->body($this->template->render());
}
return parent::after();
}
Loads the template View object.
public function before()
{
if ($this->auto_render === TRUE)
{
// Load the template
$this->template = View::factory($this->template);
}
return parent::before();
}
Creates a new controller instance. Each controller must be constructed with the request object that created it.
Request
$request
required - Request that created the controllerResponse
$response
required - The request's responsevoid
public function __construct(Request $request, Response $response)
{
// Assign the request to the controller
$this->request = $request;
// Assign a response to the controller
$this->response = $response;
}