Properties

$template_class

$template_class : string

name of class used for templates

Type

string

$tpl_vars

$tpl_vars : array

template variables

Type

array

$config_vars

$config_vars : array

configuration settings

Type

array

Methods

assign()

assign(array|string  $tpl_var, mixed  $value = null, boolean  $nocache = false) : \Smarty_Internal_Data

assigns a Smarty variable

Parameters

array|string $tpl_var

the template variable name(s)

mixed $value

the value to assign

boolean $nocache

if true any output of this variable will be not cached

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

assignGlobal()

assignGlobal(string  $varname, mixed  $value = null, boolean  $nocache = false) : \Smarty_Internal_Data

assigns a global Smarty variable

Parameters

string $varname

the global variable name

mixed $value

the value to assign

boolean $nocache

if true any output of this variable will be not cached

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

assignByRef()

assignByRef(string  $tpl_var,   $value, boolean  $nocache = false) : \Smarty_Internal_Data

assigns values to template variables by reference

Parameters

string $tpl_var

the template variable name

$value
boolean $nocache

if true any output of this variable will be not cached

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

append()

append(array|string  $tpl_var, mixed  $value = null, boolean  $merge = false, boolean  $nocache = false) : \Smarty_Internal_Data

appends values to template variables

Parameters

array|string $tpl_var

the template variable name(s)

mixed $value

the value to append

boolean $merge

flag if array elements shall be merged

boolean $nocache

if true any output of this variable will be not cached

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

appendByRef()

appendByRef(string  $tpl_var,   $value, boolean  $merge = false) : \Smarty_Internal_Data

appends values to template variables by reference

Parameters

string $tpl_var

the template variable name

$value
boolean $merge

flag if array elements shall be merged

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

getTemplateVars()

getTemplateVars(string  $varname = null, string  $_ptr = null, boolean  $search_parents = true) : string

Returns a single or all template variables

Parameters

string $varname

variable name or null

string $_ptr

optional pointer to data object

boolean $search_parents

include parent templates?

Returns

string —

variable value or or array of variables

clearAssign()

clearAssign(string|array  $tpl_var) : \Smarty_Internal_Data

clear the given assigned template variable.

Parameters

string|array $tpl_var

the template variable(s) to clear

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

clearAllAssign()

clearAllAssign() : \Smarty_Internal_Data

clear all the assigned template variables.

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

configLoad()

configLoad(string  $config_file, mixed  $sections = null) : \Smarty_Internal_Data

load a config file, optionally load just selected sections

Parameters

string $config_file

filename

mixed $sections

array of section names, single section or null

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

getVariable()

getVariable(string  $variable, object  $_ptr = null, boolean  $search_parents = true,   $error_enable = true) : object

gets the object of a Smarty variable

Parameters

string $variable

the name of the Smarty variable

object $_ptr

optional pointer to data object

boolean $search_parents

search also in parent data

$error_enable

Returns

object —

the object of the variable

getConfigVariable()

getConfigVariable(string  $variable,   $error_enable = true) : mixed

gets a config variable

Parameters

string $variable

the name of the config variable

$error_enable

Returns

mixed —

the value of the config variable

getStreamVariable()

getStreamVariable(string  $variable) : mixed

gets a stream variable

Parameters

string $variable

the stream of the variable

Returns

mixed —

the value of the stream variable

getConfigVars()

getConfigVars(string  $varname = null,   $search_parents = true) : string

Returns a single or all config variables

Parameters

string $varname

variable name or null

$search_parents

Returns

string —

variable value or or array of variables

clearConfig()

clearConfig(string  $varname = null) : \Smarty_Internal_Data

Deassigns a single or all config variables

Parameters

string $varname

variable name or null

Returns

\Smarty_Internal_Data

current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining

fetch()

fetch(string  $template = null, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null, boolean  $display = false, boolean  $merge_tpl_vars = true, boolean  $no_output_filter = false) : string

fetches a rendered Smarty template

Parameters

string $template

the resource handle of the template file or template object

mixed $cache_id

cache id to be used with this template

mixed $compile_id

compile id to be used with this template

object $parent

next higher level of Smarty variables

boolean $display

true: display, false: fetch

boolean $merge_tpl_vars

if true parent template variables merged in to local scope

boolean $no_output_filter

if true do not run output filter

Returns

string —

rendered template output

display()

display(string  $template = null, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null) 

displays a Smarty template

Parameters

string $template

the resource handle of the template file or template object

mixed $cache_id

cache id to be used with this template

mixed $compile_id

compile id to be used with this template

object $parent

next higher level of Smarty variables

isCached()

isCached(string|object  $template = null, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null) : boolean

test if cache is valid

Parameters

string|object $template

the resource handle of the template file or template object

mixed $cache_id

cache id to be used with this template

mixed $compile_id

compile id to be used with this template

object $parent

next higher level of Smarty variables

Returns

boolean —

cache status

createData()

createData(object  $parent = null) 

creates a data object

Parameters

object $parent

next higher level of Smarty variables

registerPlugin()

registerPlugin(string  $type, string  $tag, callback  $callback, boolean  $cacheable = true, array  $cache_attr = null) 

Registers plugin to be used in templates

Parameters

string $type

plugin type

string $tag

name of template tag

callback $callback

PHP callback to register

boolean $cacheable

if true (default) this fuction is cachable

array $cache_attr

caching attributes if any

Throws

\SmartyException

when the plugin tag is invalid

unregisterPlugin()

unregisterPlugin(string  $type, string  $tag) 

Unregister Plugin

Parameters

string $type

of plugin

string $tag

name of plugin

registerResource()

registerResource(string  $type, \Smarty_Resource|array  $callback) 

Registers a resource to fetch a template

Parameters

string $type

name of resource type

\Smarty_Resource|array $callback

or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)

unregisterResource()

unregisterResource(string  $type) 

Unregisters a resource

Parameters

string $type

name of resource type

registerCacheResource()

registerCacheResource(string  $type, \Smarty_CacheResource  $callback) 

Registers a cache resource to cache a template's output

Parameters

string $type

name of cache resource type

\Smarty_CacheResource $callback

instance of Smarty_CacheResource to handle output caching

unregisterCacheResource()

unregisterCacheResource(string  $type) 

Unregisters a cache resource

Parameters

string $type

name of cache resource type

registerObject()

registerObject(  $object_name, object  $object_impl, array  $allowed = array(), boolean  $smarty_args = true, array  $block_methods = array()) 

Registers object to be used in templates

Parameters

$object_name
object $object_impl

the referenced PHP object to register

array $allowed

list of allowed methods (empty = all)

boolean $smarty_args

smarty argument format, else traditional

array $block_methods

list of block-methods

Throws

\SmartyException

if any of the methods in $allowed or $block_methods are invalid

getRegisteredObject()

getRegisteredObject(string  $name) : object

return a reference to a registered object

Parameters

string $name

object name

Throws

\SmartyException

if no such object is found

Returns

object

unregisterObject()

unregisterObject(string  $name) 

unregister an object

Parameters

string $name

object name

Throws

\SmartyException

if no such object is found

registerClass()

registerClass(  $class_name, string  $class_impl) 

Registers static classes to be used in templates

Parameters

$class_name
string $class_impl

the referenced PHP class to register

Throws

\SmartyException

if $class_impl does not refer to an existing class

registerDefaultPluginHandler()

registerDefaultPluginHandler(callable  $callback) 

Registers a default plugin handler

Parameters

callable $callback

class/method name

Throws

\SmartyException

if $callback is not callable

registerDefaultTemplateHandler()

registerDefaultTemplateHandler(callable  $callback) 

Registers a default template handler

Parameters

callable $callback

class/method name

Throws

\SmartyException

if $callback is not callable

registerDefaultConfigHandler()

registerDefaultConfigHandler(callable  $callback) 

Registers a default template handler

Parameters

callable $callback

class/method name

Throws

\SmartyException

if $callback is not callable

registerFilter()

registerFilter(string  $type, callback  $callback) 

Registers a filter function

Parameters

string $type

filter type

callback $callback

unregisterFilter()

unregisterFilter(string  $type, callback  $callback) 

Unregisters a filter function

Parameters

string $type

filter type

callback $callback

_get_filter_name()

_get_filter_name(callback  $function_name) 

Return internal filter name

Parameters

callback $function_name

loadFilter()

loadFilter(string  $type, string  $name) : boolean

load a filter of specified type and name

Parameters

string $type

filter type

string $name

filter name

Returns

boolean

unloadFilter()

unloadFilter(string  $type, string  $name) : boolean

unload a filter of specified type and name

Parameters

string $type

filter type

string $name

filter name

Returns

boolean

__call()

__call(string  $name, array  $args) 

Handle unknown class methods

Parameters

string $name

unknown method-name

array $args

argument array

replaceCamelcase()

replaceCamelcase(string  $match) : string

preg_replace callback to convert camelcase getter/setter to underscore property names

Parameters

string $match

match string

Returns

string —

replacemant