Text_Template
in package
A simple template engine.
Tags
Table of Contents
- $closeDelimiter : string
- $openDelimiter : string
- $template : string
- $values : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- render() : string
- Renders the template and returns the result.
- renderTo() : mixed
- Renders the template and writes the result to a file.
- setFile() : mixed
- Sets the template file.
- setVar() : mixed
- Sets one or more template variables.
Properties
$closeDelimiter
protected
string
$closeDelimiter
= '}'
$openDelimiter
protected
string
$openDelimiter
= '{'
$template
protected
string
$template
= ''
$values
protected
array<string|int, mixed>
$values
= array()
Methods
__construct()
Constructor.
public
__construct([string $file = '' ][, mixed $openDelimiter = '{' ][, mixed $closeDelimiter = '}' ]) : mixed
Parameters
- $file : string = ''
- $openDelimiter : mixed = '{'
- $closeDelimiter : mixed = '}'
Tags
Return values
mixed —render()
Renders the template and returns the result.
public
render() : string
Return values
string —renderTo()
Renders the template and writes the result to a file.
public
renderTo(string $target) : mixed
Parameters
- $target : string
Return values
mixed —setFile()
Sets the template file.
public
setFile(string $file) : mixed
Parameters
- $file : string
Tags
Return values
mixed —setVar()
Sets one or more template variables.
public
setVar(array<string|int, mixed> $values[, bool $merge = TRUE ]) : mixed
Parameters
- $values : array<string|int, mixed>
- $merge : bool = TRUE