Modules

Controller_Welcome
extends Controller
extends Kohana_Controller

Abstract controller class. Controllers should only be created using a Request.

Controllers methods will be automatically called in the following order by the request:

$controller = new Controller_Foo($request);
$controller->before();
$controller->action_bar();
$controller->after();

The controller action should add the output it creates to $this->request->response, typically in the form of a View, during the "action" part of execution.

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

Class declared in APPPATH/classes/controller/welcome.php on line 3.

Constants

  • None

Properties

Properties

public Request $request

Request that created the controller

Methods

public action_index( ) (defined in Controller_Welcome)

Source Code

public function action_index()
{
	$this->request->response = 'hello, world!';
}

public __construct( Request $request ) (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

Return Values

  • void

Source Code

public function __construct(Request $request)
{
	// Assign the request to the controller
	$this->request = $request;
}

public after( ) (defined in Kohana_Controller)

Automatically executed after the controller action. Can be used to apply transformation to the request response, add extra output, and execute other custom code.

Return Values

  • void

Source Code

public function after()
{
	// Nothing by default
}

public before( ) (defined in Kohana_Controller)

Automatically executed before the controller action. Can be used to set class properties, do authorization checks, and execute other custom code.

Return Values

  • void

Source Code

public function before()
{
	// Nothing by default
}