PHP Класс Kohana_Controller, kohana-twig

It adds hooks to the construct, before and after methods. example to execute functions instead of the current action: To go along before/after the action is called:
Автор: Chema ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$__context Standalone context
$request Request that created the controller
$response The response that will be returned from controller

Защищенные свойства (Protected)

Свойство Тип Описание
$_auto_render Auto-render template after controller method returns
$_environment Twig_Environment
$_template_path Template path that points to the action view

Открытые методы

Метод Описание
__construct ( Request $request, Response $response ) : void Creates a new controller instance. Each controller must be constructed with the request object that created it.
__get ( mixed $key ) : array Have a standalone action context. A context should not be within a template because not all request require a template, thus, we allow the controller to handle the context for later manipulation. We use magic methods to manipulate the data:
__set ( string $key, mixed $value ) : mixed Have a standalone action context. A context should not be within a template because not all request require a template, thus, we allow the controller to handle the context for later manipulation. We use magic methods to manipulate the data:
after ( ) : void Renders the template if necessary
before ( ) : void Before the action gets executed we need run a few processes.

Защищенные методы

Метод Описание
_set_template_path ( string $path, string $file, string $extension = "html" ) : boolean Load the path that points to the view (if applicable).

Описание методов

__construct() публичный Метод

Creates a new controller instance. Each controller must be constructed with the request object that created it.
public __construct ( Request $request, Response $response ) : void
$request Request Request that created the controller
$response Response The request's response
Результат void

__get() публичный Метод

class Controller_Object{ public function action_index() { Setter $this->var1 = "test"; $this->var2 = array( 'k1' => 'v1', 'k2' => 'v2', 'k3' => 'v3', ); } }
public __get ( mixed $key ) : array
$key mixed
Результат array

__set() публичный Метод

class Controller_Object{ public function action_index() { Getter $var1 = $this->var1; modify the var1 $this->var1 = $var1; } }
public __set ( string $key, mixed $value ) : mixed
$key string
$value mixed
Результат mixed

_set_template_path() защищенный Метод

We return a bool so that the method can be reused even if there's the need to extend the method
protected _set_template_path ( string $path, string $file, string $extension = "html" ) : boolean
$path string Directory path
$file string File name
$extension string File Extension
Результат boolean This boolean determines whether the file exists or not

after() публичный Метод

Renders the template if necessary
public after ( ) : void
Результат void

before() публичный Метод

Before the action gets executed we need run a few processes.
public before ( ) : void
Результат void

Описание свойств

$__context публичное свойство

Standalone context
public $__context

$_auto_render защищенное свойство

Auto-render template after controller method returns
protected $_auto_render

$_environment защищенное свойство

protected Twig_Environment $_environment
Результат Twig_Environment

$_template_path защищенное свойство

Template path that points to the action view
protected $_template_path

$request публичное свойство

Request that created the controller
public $request

$response публичное свойство

The response that will be returned from controller
public $response