Smarty 2.0 Templates.
This class implements the entire Smarty 2.0 template specification. For documentation on the Smarty 2.0 template format see the Smarty 2.0 online documentation: https://www.smarty.net/docsv2/en/
Tags are in the format of {$tagname}. This tag would reference a parameter passed to the parser with the array key value of 'tagname'. Such as:
$tpl = new \Hazaar\Template\Smarty($template_content);
$tpl->render(['tagname' => 'Hello, World!']);
public bool $allowGlobals
public string $sourceFile
protected string $__content
protected string $__compiled_content
protected array $__custom_functions
protected array $__includes
protected array $__include_funcs
private array $__custom_function_handlers
private array $__section_stack
private array $__foreach_stack
private array $__capture_stack
Create a new Smarty template object.
public __construct({Array})
Parameter | Type | Description |
---|
$content | string | |
$include_funcs | array | |
Load the SMARTy template from a supplied string.
public loadFromString({Array})
Parameter | Type | Description |
---|
$content | string | The template source code |
Read the template from a file.
public loadFromFile({Array})
Parameter | Type | Description |
---|
$file | string | can be either a Hazaar\File object or a string to a file on disk |
public registerFunctionHandler({Array})
Parameter | Type | Description |
---|
$object | object | |
public registerPlugin({Array})
Parameter | Type | Description |
---|
$modifier | string | |
$callback | callable | |
Returns the original un-compiled template.
public getTemplate({Array})
Retrieves the template file path.
public getTemplateFile({Array})
Prepend a string to the existing content.
Parameter | Type | Description |
---|
$string | string | |
Append a string to the existing content.
Parameter | Type | Description |
---|
$string | string | |
Render the template with the supplied parameters and return the rendered content.
Parameter | Type | Description |
---|
$params | array | parameters to use when embedding variables in the rendered template |
Compile the template ready for rendering.
This will normally happen automatically when calling Hazaar\Template\Smarty::render() but can be called separately if needed. The compiled template content is returned and can be stored externally.
public compilePHP({Array})
public compileENDPHP({Array})
protected setType({Array})
Parameter | Type | Description |
---|
$value | mixed | |
$type | string | |
$args | string | |
protected parsePARAMS({Array})
Parameter | Type | Description |
---|
$params | string | |
$keep_quotes | bool | |
protected compileVAR({Array})
Parameter | Type | Description |
---|
$name | string | |
protected compileVARS({Array})
Parameter | Type | Description |
---|
$string | string | |
protected replaceVAR({Array})
Parameter | Type | Description |
---|
$name | string | |
protected replaceCONFIG_VAR({Array})
Parameter | Type | Description |
---|
$name | string | |
protected compilePARAMS({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileIF({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileELSEIF({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileELSE({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileENDIF({Array})
protected compileSECTION({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileSECTIONELSE({Array})
protected compileENDSECTION({Array})
protected compileURL({Array})
Parameter | Type | Description |
---|
$tag | string | |
protected compileFOREACH({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileFOREACHELSE({Array})
protected compileENDFOREACH({Array})
protected compileLDELIM({Array})
protected compileRDELIM({Array})
protected compileCAPTURE({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileENDCAPTURE({Array})
protected compileASSIGN({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileFUNCTION({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileENDFUNCTION({Array})
protected compileCUSTOMFUNC({Array})
Parameter | Type | Description |
---|
$name | string | |
$params | mixed | |
protected compileCUSTOMHANDLERFUNC({Array})
Parameter | Type | Description |
---|
$handler | object | |
$method | string | |
$params | mixed | |
$index | int | |
protected compileCALL({Array})
Parameter | Type | Description |
---|
$params | mixed | |
protected compileINCLUDE({Array})
Parameter | Type | Description |
---|
$params | mixed | |
Generated by Hazaar API Doc Generator