Documentation

TemplateEngine
in package

AbstractYes

Base template engine class to be extended.

Tags
author

Samerton

license

MIT

version
2.2.0

Table of Contents

Properties

$_variables  : array<string|int, mixed>

Methods

__construct()  : mixed
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

Methods

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 abstract clearCache() : void

fetch()

Fetch a generated template file using the set template engine.

public abstract 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 abstract render(string $templateFile) : void
Parameters
$templateFile : string

Path to template file to render.


        
On this page

Search results