PHP Class lithium\template\view\adapter\File

For more information about implementing your own template loaders or renderers, see the lithium\template\View class.
See also: lithium\template\View
See also: lithium\template\view\Compiler
Inheritance: extends lithium\template\view\Renderer
显示文件 Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Property Type Description
$_autoConfig array These configuration variables will automatically be assigned to their corresponding protected properties when the object is initialized.
$_classes array File's dependencies. These classes are used by the output handlers to generate URLs for dynamic resources and static assets, as well as compiling the templates.
$_compile boolean Boolean flag indicating whether templates should be pre-compiled before inclusion. For more information on template compilation, see view\Compiler.
$_data array An array containing the variables currently in the scope of the template. These values are manipulable using array syntax against the template object, i.e. $this['foo'] = 'bar' inside your template files.
$_paths
$_vars Variables that have been set from a view/element/layout/etc. that should be available to the same rendering context.

Public Methods

Method Description
__construct ( array $config = [] ) : void Constructor.
offsetExists ( string $offset ) : boolean Allows checking to see if a value is set in template data.
offsetGet ( string $offset ) : mixed Gets the offset, or null in the template data.
offsetSet ( string $offset, mixed $value ) : void Sets the offset with the given value.
offsetUnset ( string $offset ) : void Unsets the given offset.
render ( string $template, array | string $data = [], array $options = [] ) : string Renders content from a template file provided by template().
template ( string $type, array $params ) : string Returns a template file name

Protected Methods

Method Description
_paths ( string $type, array $params ) : string Searches one or more path templates for a matching template file, and returns the file name.

Method Details

__construct() public method

Constructor.
public __construct ( array $config = [] ) : void
$config array Configuration options.
return void

_paths() protected method

Searches one or more path templates for a matching template file, and returns the file name.
protected _paths ( string $type, array $params ) : string
$type string
$params array The set of options keys to be interpolated into the path templates when searching for the correct file to load.
return string Returns the first template file found. Throws an exception if no templates are available.

offsetExists() public method

Part of ArrayAccess. isset($file['bar']); $file->offsetExists('bar');
public offsetExists ( string $offset ) : boolean
$offset string Key / variable name to check.
return boolean Returns `true` if the value is set, otherwise `false`.

offsetGet() public method

Part of ArrayAccess. $file['bar']; $file->offsetGet('bar');
public offsetGet ( string $offset ) : mixed
$offset string Key / variable name to check.
return mixed

offsetSet() public method

Part of ArrayAccess. $file['bar'] = 'baz'; $file->offsetSet('bar', 'baz');
public offsetSet ( string $offset, mixed $value ) : void
$offset string Key / variable name to check.
$value mixed Value you wish to set to `$offset`.
return void

offsetUnset() public method

Part of ArrayAccess. unset($file['bar']); $file->offsetUnset('bar');
public offsetUnset ( string $offset ) : void
$offset string Key / variable name to check.
return void

render() public method

Renders content from a template file provided by template().
public render ( string $template, array | string $data = [], array $options = [] ) : string
$template string
$data array | string
$options array
return string

template() public method

Returns a template file name
public template ( string $type, array $params ) : string
$type string
$params array
return string

Property Details

$_autoConfig protected_oe property

These configuration variables will automatically be assigned to their corresponding protected properties when the object is initialized.
protected array $_autoConfig
return array

$_classes protected_oe property

File's dependencies. These classes are used by the output handlers to generate URLs for dynamic resources and static assets, as well as compiling the templates.
See also: Renderer::$_handlers
protected array $_classes
return array

$_compile protected_oe property

Boolean flag indicating whether templates should be pre-compiled before inclusion. For more information on template compilation, see view\Compiler.
See also: lithium\template\view\Compiler
protected bool $_compile
return boolean

$_data protected_oe property

An array containing the variables currently in the scope of the template. These values are manipulable using array syntax against the template object, i.e. $this['foo'] = 'bar' inside your template files.
protected array $_data
return array

$_paths protected_oe property

protected $_paths

$_vars protected_oe property

Variables that have been set from a view/element/layout/etc. that should be available to the same rendering context.
protected $_vars