PHP Class Box\Brainy\Templates\TemplateBase

Inheritance: extends Box\Brainy\Templates\TemplateData
Mostra file Open project: box/brainy Class Usage Examples

Public Properties

Property Type Description
$smarty Smarty Global smarty instance
$strict_mode boolean Flag indicating that the template is running in strict mode
$template_resource string Template resource

Public Methods

Method Description
__construct ( Box\Brainy\Brainy $brainyInstance, boolean | void $useRootScope = false )
assertIsNotStrict ( string $reason ) : void
display ( string | null | void $template = null, string | null | void $compile_id = null ) : void Renders the template.
fetch ( string | void $template = null, mixed | void $compile_id = null ) : string Renders and returns a template.
renderSubTemplate ( string $template, mixed $compile_id, $data, integer $parent_scope ) : void Template code runtime function to get subtemplate content
setVariable ( string $var, mixed $value, integer $scope ) : void Assigns $value to the variale $var.

Method Details

__construct() public method

public __construct ( Box\Brainy\Brainy $brainyInstance, boolean | void $useRootScope = false )
$brainyInstance Box\Brainy\Brainy
$useRootScope boolean | void Whether to clone data from the root scope

assertIsNotStrict() public method

public assertIsNotStrict ( string $reason ) : void
$reason string
return void

display() public method

This displays the contents of a template. To return the contents of a template into a variable, use the fetch() method instead. As an optional second and third parameter, you can pass a cache ID and compile ID. A fourth parameter can be passed which passes the parent scope that the template should use.
public display ( string | null | void $template = null, string | null | void $compile_id = null ) : void
$template string | null | void the resource handle of the template file or template object
$compile_id string | null | void compile id to be used with this template
return void

fetch() public method

This returns the template output instead of displaying it.
public fetch ( string | void $template = null, mixed | void $compile_id = null ) : string
$template string | void the resource handle of the template file or template object
$compile_id mixed | void compile id to be used with this template
return string rendered template output

renderSubTemplate() public method

Template code runtime function to get subtemplate content
public renderSubTemplate ( string $template, mixed $compile_id, $data, integer $parent_scope ) : void
$template string the resource handle of the template file
$compile_id mixed compile id to be used with this template
$parent_scope integer scope in which {include} should execute
return void

setVariable() public method

Assigns $value to the variale $var.
See also: TemplateData::assignSingleVar()
public setVariable ( string $var, mixed $value, integer $scope ) : void
$var string the template variable name
$value mixed the value to assign
$scope integer the scope to associate with the Smarty_Variable
return void

Property Details

$smarty public_oe property

Global smarty instance
public Smarty $smarty
return Smarty

$strict_mode public_oe property

Flag indicating that the template is running in strict mode
public bool $strict_mode
return boolean

$template_resource public_oe property

Template resource
public string $template_resource
return string