Abstract controller class for automatic templating.
Class declared in SYSPATH/classes/controller/template.php on line 3.
boolean
$auto_renderlink to thisauto render template
Request
$requestlink to thisRequest that created the controller
Response
$responselink to thisThe response that will be returned from controller
View
$templatelink to thispage template
Assigns the template View as the request response.
public
function
after()
{
if
(
$this
->auto_render === TRUE)
{
$this
->response->body(
$this
->template->render());
}
parent::after();
}
Loads the template View object.
public
function
before()
{
parent::before();
if
(
$this
->auto_render === TRUE)
{
// Load the template
$this
->template = View::factory(
$this
->template);
}
}
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
;
}