Modules

abstract Kohana_Controller_Template
extends Controller
extends Kohana_Controller

Abstract controller class for automatic templating.

package
Kohana
category
Controller
author
Kohana Team
copyright
© 2008-2012 Kohana Team
license
http://kohanaframework.org/license

Class declared in SYSPATH/classes/kohana/controller/template.php on line 11.

Properties

public boolean $auto_render

auto render template

public Request $request

Request that created the controller

public Response $response

The response that will be returned from controller

public View $template

page template

Methods

public after( ) (defined in Kohana_Controller_Template)

Assigns the template View as the request response.

Source Code

public function after()
{
	if ($this->auto_render === TRUE)
	{
		$this->response->body($this->template->render());
	}

	parent::after();
}

public before( ) (defined in Kohana_Controller_Template)

Loads the template View object.

Source Code

public function before()
{
	parent::before();

	if ($this->auto_render === TRUE)
	{
		// Load the template
		$this->template = View::factory($this->template);
	}
}

public __construct( Request $request , Response $response ) (defined in Kohana_Controller)

Creates a new controller instance. Each controller must be constructed with the request object that created it.

Parameters

  • Request $request required - Request that created the controller
  • Response $response required - The request's response

Return Values

  • void

Source Code

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;
}