PHP Interface Webiny\Component\TemplateEngine\TemplateEngineInterface

显示文件 Open project: Webiny/Framework

Public Methods

Method Description
assign ( string $var, mixed $value ) : void Assign a variable and its value into the template engine.
fetch ( string $template, array $parameters = [] ) : string Fetch the template from the given location, parse it and return the output.
registerPlugin ( Plugin $plugin ) : void Register a plugin for the template engine.
render ( string $template, array $parameters = [] ) : void Fetch the template from the given location, parse it and output the result to the browser.
setTemplateDir ( string $path ) : void Root dir where the templates are stored.

Method Details

assign() public method

Assign a variable and its value into the template engine.
public assign ( string $var, mixed $value ) : void
$var string Variable name.
$value mixed Variable value.
return void

fetch() public method

Fetch the template from the given location, parse it and return the output.
public fetch ( string $template, array $parameters = [] ) : string
$template string Path to the template.
$parameters array A list of parameters to pass to the template.
return string Parsed template.

registerPlugin() public method

Register a plugin for the template engine.
public registerPlugin ( Plugin $plugin ) : void
$plugin Plugin
return void

render() public method

Fetch the template from the given location, parse it and output the result to the browser.
public render ( string $template, array $parameters = [] ) : void
$template string Path to the template.
$parameters array A list of parameters to pass to the template.
return void

setTemplateDir() public method

Root dir where the templates are stored.
public setTemplateDir ( string $path ) : void
$path string Absolute path to the directory that holds the templates.
return void