PHP Класс Webiny\Component\TemplateEngine\Bridge\Smarty\Smarty

Наследование: implements Webiny\Component\TemplateEngine\Bridge\TemplateEngineInterface, use trait Webiny\Component\ServiceManager\ServiceManagerTrait
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ConfigObject $config ) Base constructor.
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.
getCacheDir ( ) : string Returns the current cache dir.
getCompileDir ( ) : string Returns the current compile dir.
getForceCompile ( ) : boolean Returns the current value of force_compile flag.
getMergeCompiledIncludes ( ) : boolean Returns the current value of inheritance_merge_compiled_includes flag.
getTemplateDir ( ) : string Returns the current template dir.
registerExtensions ( ) Gets the registered Smarty extensions that have been registered over the ServiceManager and assigns them to current Smarty instance.
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.
setCacheDir ( string $cacheDir ) Set Smarty cache dir.
setCompileDir ( string $compileDir ) Set Smarty compile dir.
setForceCompile ( boolean $forceCompile ) Force to re-compile the templates on every refresh.
setMergeCompiledIncludes ( boolean $mergeCompiledIncludes ) Force to re-compile the templates on every refresh.
setTemplateDir ( string $templateDir ) : void Root path where the templates are stored.

Описание методов

__construct() публичный Метод

Base constructor.
public __construct ( ConfigObject $config )
$config Webiny\Component\Config\ConfigObject Configuration for the template engine.

assign() публичный Метод

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.
Результат void

fetch() публичный Метод

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.
Результат string Parsed template.

getCacheDir() публичный Метод

Returns the current cache dir.
public getCacheDir ( ) : string
Результат string Absolute path to cache dir.

getCompileDir() публичный Метод

Returns the current compile dir.
public getCompileDir ( ) : string
Результат string Absolute path to compile dir.

getForceCompile() публичный Метод

Returns the current value of force_compile flag.
public getForceCompile ( ) : boolean
Результат boolean

getMergeCompiledIncludes() публичный Метод

Returns the current value of inheritance_merge_compiled_includes flag.
public getMergeCompiledIncludes ( ) : boolean
Результат boolean

getTemplateDir() публичный Метод

Returns the current template dir.
public getTemplateDir ( ) : string
Результат string Absolute path to template dir.

registerExtensions() публичный Метод

NOTE: This function is automatically called by the class constructor.
public registerExtensions ( )

registerPlugin() публичный Метод

Register a plugin for the template engine.
public registerPlugin ( Plugin $plugin ) : void
$plugin Webiny\Component\TemplateEngine\Plugin
Результат void

render() публичный Метод

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.
Результат void

setCacheDir() публичный Метод

Set Smarty cache dir.
public setCacheDir ( string $cacheDir )
$cacheDir string Absolute path where to store cache files.

setCompileDir() публичный Метод

Set Smarty compile dir.
public setCompileDir ( string $compileDir )
$compileDir string Absolute path where to store compiled files.

setForceCompile() публичный Метод

Force to re-compile the templates on every refresh.
public setForceCompile ( boolean $forceCompile )
$forceCompile boolean

setMergeCompiledIncludes() публичный Метод

Force to re-compile the templates on every refresh.
public setMergeCompiledIncludes ( boolean $mergeCompiledIncludes )
$mergeCompiledIncludes boolean

setTemplateDir() публичный Метод

Root path where the templates are stored.
public setTemplateDir ( string $templateDir ) : void
$templateDir string
Результат void