SmartyTemplateEngine
extends TemplateEngine
in package
Smarty template engine.
Tags
Table of Contents
Properties
- $_securityPolicy : Smarty_Security
- $_smarty : Smarty
- $_variables : array<string|int, mixed>
Methods
- __construct() : mixed
- addSecurityPolicyDirectory() : void
- Add an extra directory to the Smarty security policy.
- addVariable() : void
- Register a template variable.
- addVariables() : void
- Register several template variables.
- clearCache() : void
- Clear template cache directory.
- fetch() : string
- Fetch a generated template file using the set template engine.
- getVariable() : mixed
- Get a template variable.
- getVariables() : array<string|int, mixed>
- Get all template variables.
- render() : void
- Render a template file using the set template engine.
Properties
$_securityPolicy
protected
Smarty_Security
$_securityPolicy
$_smarty
private
Smarty
$_smarty
$_variables
private
array<string|int, mixed>
$_variables
Methods
__construct()
public
__construct(string $dir) : mixed
Parameters
- $dir : string
-
Path to template directory
Tags
addSecurityPolicyDirectory()
Add an extra directory to the Smarty security policy.
public
addSecurityPolicyDirectory(string $dir) : void
Parameters
- $dir : string
-
Directory to add to policy
addVariable()
Register a template variable.
public
addVariable(string $key, mixed $value) : void
TODO: mixed type for $value
Parameters
- $key : string
- $value : mixed
addVariables()
Register several template variables.
public
addVariables(array<string|int, mixed> $variables) : void
Parameters
- $variables : array<string|int, mixed>
clearCache()
Clear template cache directory.
public
clearCache() : void
fetch()
Fetch a generated template file using the set template engine.
public
fetch(string $templateFile) : string
Parameters
- $templateFile : string
-
Path to template file to render.
Return values
string —HTML to render
getVariable()
Get a template variable.
public
getVariable(string $key) : mixed
Parameters
- $key : string
getVariables()
Get all template variables.
public
getVariables() : array<string|int, mixed>
Return values
array<string|int, mixed>render()
Render a template file using the set template engine.
public
render(string $templateFile) : void
Parameters
- $templateFile : string
-
Path to template file to render.