PHP 클래스 Kohana_Twig, kohana-twig

저자: Jonathan Geiger
파일 보기 프로젝트 열기: jonathangeiger/kohana-twig 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_data Local data
$_environment The environment the view is attached to
$_extension The extension of the file
$_file The file to render
$_global_data Global data, merged just before compilation

공개 메소드들

메소드 설명
__construct ( $file = NULL, array $data = NULL, $env = 'default' ) Constructor
__get ( $key ) : mixed Magic method. See get()
__isset ( $key ) : boolean Magic method, determines if a variable is set and is not NULL.
__set ( $key, $value ) : void Magic method, calls set() with the same parameters.
__toString ( ) : string Magic method, returns the output of render(). If any exceptions are thrown, the exception output will be returned instead.
__unset ( $key ) : void Magic method, unsets a given variable.
as_array ( ) : array Returns the final data plus global data merged as an array
bind ( $key, &$value ) : View Assigns a value by reference. The benefit of binding is that values can be altered without re-setting them. It is also possible to bind variables before they have values. Assigned values will be available as a variable within the view file:
bind_global ( $key, &$value ) : View Assigns a global variable by reference, similar to the bind() method.
environment ( ) : Twig_Environment Returns the environment this view is attached to
extension ( ) : string Returns the template's extension
factory ( string $file = NULL, string $data = NULL, string $env = 'default' ) : void Factory for Twigs
filename ( ) : string Returns the templates filename (sans extension)
get ( $key, $default = NULL ) : mixed Searches for the given variable and returns its value.
path ( ) : string Returns the full path of the current template ($filename + $extension)
render ( $file = NULL ) : string Renders the view object to a string. Global and local data are merged and extracted to create local variables within the view file.
set ( $key, $value = NULL ) : View Assigns a variable by name. Assigned values will be available as a variable within the view file:
set_extension ( string $extension ) : void Sets a file exension
set_filename ( $file ) : View Sets the view filename.
set_global ( $key, $value = NULL ) : View Sets a global variable, similar to the set() method.

메소드 상세

__construct() 공개 메소드

Constructor
저자: Jonathan Geiger
public __construct ( $file = NULL, array $data = NULL, $env = 'default' )
$data array

__get() 공개 메소드

Magic method. See get()
public __get ( $key ) : mixed
리턴 mixed

__isset() 공개 메소드

Magic method, determines if a variable is set and is not NULL.
public __isset ( $key ) : boolean
리턴 boolean

__set() 공개 메소드

Magic method, calls set() with the same parameters.
public __set ( $key, $value ) : void
리턴 void

__toString() 공개 메소드

Magic method, returns the output of render(). If any exceptions are thrown, the exception output will be returned instead.
public __toString ( ) : string
리턴 string

__unset() 공개 메소드

Magic method, unsets a given variable.
public __unset ( $key ) : void
리턴 void

as_array() 공개 메소드

Returns the final data plus global data merged as an array
저자: Jonathan Geiger
public as_array ( ) : array
리턴 array

bind() 공개 메소드

This reference can be accessed as $ref within the view $view->bind('ref', $bar);
public bind ( $key, &$value ) : View
리턴 View

bind_global() 공개 정적인 메소드

Assigns a global variable by reference, similar to the bind() method.
public static bind_global ( $key, &$value ) : View
리턴 View

environment() 공개 메소드

Returns the environment this view is attached to
저자: Jonathan Geiger
public environment ( ) : Twig_Environment
리턴 Twig_Environment

extension() 공개 메소드

Returns the template's extension
저자: Jonathan Geiger
public extension ( ) : string
리턴 string

factory() 공개 정적인 메소드

Factory for Twigs
저자: Jonathan Geiger
public static factory ( string $file = NULL, string $data = NULL, string $env = 'default' ) : void
$file string
$data string
$env string
리턴 void

filename() 공개 메소드

Returns the templates filename (sans extension)
저자: Jonathan Geiger
public filename ( ) : string
리턴 string

get() 공개 메소드

Local variables will be returned before global variables.
public get ( $key, $default = NULL ) : mixed
리턴 mixed

path() 공개 메소드

Returns the full path of the current template ($filename + $extension)
저자: Jonathan Geiger
public path ( ) : string
리턴 string

render() 공개 메소드

Note: Global variables with the same key name as local variables will be overwritten by the local variable.
public render ( $file = NULL ) : string
리턴 string

set() 공개 메소드

This value can be accessed as $foo within the view $view->set('foo', 'my value'); You can also use an array to set several values at once: Create the values $food and $beverage in the view $view->set(array('food' => 'bread', 'beverage' => 'water'));
public set ( $key, $value = NULL ) : View
리턴 View

set_extension() 공개 메소드

Sets a file exension
저자: Jonathan Geiger
public set_extension ( string $extension ) : void
$extension string
리턴 void

set_filename() 공개 메소드

Sets the view filename.
public set_filename ( $file ) : View
리턴 View

set_global() 공개 정적인 메소드

The name is a bit of a misnomer, since Twig has no real concept of "global" variables, just one context available to the entire view structure. However, it is implemented to provide an API similar to Kohana_View, as well as to allow passing a default set of values (perhaps from the 'context' configuration) that can be overridden by set(). The global data persists across environments.
public static set_global ( $key, $value = NULL ) : View
리턴 View

프로퍼티 상세

$_data 보호되어 있는 프로퍼티

Local data
protected $_data

$_environment 보호되어 있는 프로퍼티

The environment the view is attached to
protected $_environment

$_extension 보호되어 있는 프로퍼티

The extension of the file
protected $_extension

$_file 보호되어 있는 프로퍼티

The file to render
protected $_file

$_global_data 보호되어 있는 정적으로 프로퍼티

Global data, merged just before compilation
protected static $_global_data