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])
파일 보기 프로젝트 열기: jonathangeiger/kohana-twig 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$__context Standalone context
$request Request that created the controller
$response The response that will be returned from controller

보호된 프로퍼티들

프로퍼티 타입 설명
$_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