$template_class
$template_class : string
name of class used for templates
Main class with template data structures and methods
$parent : \Smarty_Internal_Template
parent template (if any)
$smarty : \Smarty
Global smarty instance
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
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 |
rendered template output
display(string $template = null, mixed $cache_id = null, mixed $compile_id = null, object $parent = null)
displays a Smarty template
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(string|object $template = null, mixed $cache_id = null, mixed $compile_id = null, object $parent = null) : boolean
test if cache is valid
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 |
cache status
registerPlugin(string $type, string $tag, callback $callback, boolean $cacheable = true, array $cache_attr = null)
Registers plugin to be used in templates
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 |
when the plugin tag is invalid
registerResource(string $type, \Smarty_Resource|array $callback)
Registers a resource to fetch a template
string | $type | name of resource type |
\Smarty_Resource|array | $callback | or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated) |
registerCacheResource(string $type, \Smarty_CacheResource $callback)
Registers a cache resource to cache a template's output
string | $type | name of cache resource type |
\Smarty_CacheResource | $callback | instance of Smarty_CacheResource to handle output caching |
registerObject( $object_name, object $object_impl, array $allowed = array(), boolean $smarty_args = true, array $block_methods = array())
Registers object to be used in templates
$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 |
if any of the methods in $allowed or $block_methods are invalid
assign(array|string $tpl_var, mixed $value = null, boolean $nocache = false) : \Smarty_Internal_Data
assigns a Smarty variable
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 |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
assignGlobal(string $varname, mixed $value = null, boolean $nocache = false) : \Smarty_Internal_Data
assigns a global Smarty variable
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 |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
assignByRef(string $tpl_var, $value, boolean $nocache = false) : \Smarty_Internal_Data
assigns values to template variables by reference
string | $tpl_var | the template variable name |
$value | ||
boolean | $nocache | if true any output of this variable will be not cached |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
append(array|string $tpl_var, mixed $value = null, boolean $merge = false, boolean $nocache = false) : \Smarty_Internal_Data
appends values to template variables
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 |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
appendByRef(string $tpl_var, $value, boolean $merge = false) : \Smarty_Internal_Data
appends values to template variables by reference
string | $tpl_var | the template variable name |
$value | ||
boolean | $merge | flag if array elements shall be merged |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
getTemplateVars(string $varname = null, string $_ptr = null, boolean $search_parents = true) : string
Returns a single or all template variables
string | $varname | variable name or null |
string | $_ptr | optional pointer to data object |
boolean | $search_parents | include parent templates? |
variable value or or array of variables
clearAssign(string|array $tpl_var) : \Smarty_Internal_Data
clear the given assigned template variable.
string|array | $tpl_var | the template variable(s) to clear |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
clearAllAssign() : \Smarty_Internal_Data
clear all the assigned template variables.
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
configLoad(string $config_file, mixed $sections = null) : \Smarty_Internal_Data
load a config file, optionally load just selected sections
string | $config_file | filename |
mixed | $sections | array of section names, single section or null |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
getVariable(string $variable, object $_ptr = null, boolean $search_parents = true, $error_enable = true) : object
gets the object of a Smarty variable
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 |
the object of the variable
clearConfig(string $varname = null) : \Smarty_Internal_Data
Deassigns a single or all config variables
string | $varname | variable name or null |
current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
__construct(string $template_resource, \Smarty $smarty, \Smarty_Internal_Template $_parent = null, mixed $_cache_id = null, mixed $_compile_id = null, boolean $_caching = null, integer $_cache_lifetime = null)
Create template data object
Some of the global Smarty settings copied to template scope It load the required template resources and cacher plugins
string | $template_resource | template resource string |
\Smarty | $smarty | Smarty instance |
\Smarty_Internal_Template | $_parent | back pointer to parent object with variables or null |
mixed | $_cache_id | cache id or null |
mixed | $_compile_id | compile id or null |
boolean | $_caching | use caching? |
integer | $_cache_lifetime | cache life-time in seconds |
getSubTemplate(string $template, mixed $cache_id, mixed $compile_id, integer $caching, integer $cache_lifetime, $data, integer $parent_scope)
Template code runtime function to get subtemplate content
string | $template | the resource handle of the template file |
mixed | $cache_id | cache id to be used with this template |
mixed | $compile_id | compile id to be used with this template |
integer | $caching | cache mode |
integer | $cache_lifetime | life time of cache data |
$data | ||
integer | $parent_scope | scope in which {include} should execute |
setupInlineSubTemplate(string $template, mixed $cache_id, mixed $compile_id, integer $caching, integer $cache_lifetime, $data, integer $parent_scope, string $hash)
Template code runtime function to set up an inline subtemplate
string | $template | the resource handle of the template file |
mixed | $cache_id | cache id to be used with this template |
mixed | $compile_id | compile id to be used with this template |
integer | $caching | cache mode |
integer | $cache_lifetime | life time of cache data |
$data | ||
integer | $parent_scope | scope in which {include} should execute |
string | $hash | nocache hash code |
decodeProperties(array $properties, boolean $cache = false) : boolean
This function is executed automatically when a compiled or cached template file is included
array | $properties | special template properties |
boolean | $cache | flag if called from cache file |
flag if compiled or cache file is valid
createLocalArrayVariable(string $tpl_var, boolean $nocache = false, integer $scope = \Smarty::SCOPE_LOCAL)
Template code runtime function to create a local Smarty variable for array assignments
string | $tpl_var | tempate variable name |
boolean | $nocache | cache mode of variable |
integer | $scope | scope of variable |