\SmartyBC

Smarty Backward Compatability Wrapper Class

Summary

Methods
Properties
Constants
__construct()
__destruct()
__clone()
__get()
__set()
templateExists()
getGlobal()
clearAllCache()
clearCache()
enableSecurity()
disableSecurity()
setTemplateDir()
addTemplateDir()
getTemplateDir()
setConfigDir()
addConfigDir()
getConfigDir()
setPluginsDir()
addPluginsDir()
getPluginsDir()
setCompileDir()
getCompileDir()
setCacheDir()
getCacheDir()
setDefaultModifiers()
addDefaultModifiers()
getDefaultModifiers()
setAutoloadFilters()
addAutoloadFilters()
getAutoloadFilters()
getDebugTemplate()
setDebugTemplate()
createTemplate()
loadPlugin()
compileAllTemplates()
compileAllConfig()
clearCompiledTemplate()
getTags()
testInstall()
mutingErrorHandler()
muteExpectedErrors()
unmuteExpectedErrors()
fetch()
display()
isCached()
createData()
registerPlugin()
unregisterPlugin()
registerResource()
unregisterResource()
registerCacheResource()
unregisterCacheResource()
registerObject()
getRegisteredObject()
unregisterObject()
registerClass()
registerDefaultPluginHandler()
registerDefaultTemplateHandler()
registerDefaultConfigHandler()
registerFilter()
unregisterFilter()
_get_filter_name()
loadFilter()
unloadFilter()
__call()
assign()
assignGlobal()
assignByRef()
append()
appendByRef()
getTemplateVars()
clearAssign()
clearAllAssign()
configLoad()
getVariable()
getConfigVariable()
getStreamVariable()
getConfigVars()
clearConfig()
assign_by_ref()
append_by_ref()
clear_assign()
register_function()
unregister_function()
register_object()
unregister_object()
register_block()
unregister_block()
register_compiler_function()
unregister_compiler_function()
register_modifier()
unregister_modifier()
register_resource()
unregister_resource()
register_prefilter()
unregister_prefilter()
register_postfilter()
unregister_postfilter()
register_outputfilter()
unregister_outputfilter()
load_filter()
clear_cache()
clear_all_cache()
is_cached()
clear_all_assign()
clear_compiled_tpl()
template_exists()
get_template_vars()
get_config_vars()
config_load()
get_registered_object()
clear_config()
trigger_error()
$global_tpl_vars
$_previous_error_handler
$_muted_directories
$auto_literal
$error_unassigned
$use_include_path
$joined_template_dir
$joined_config_dir
$default_template_handler_func
$default_config_handler_func
$default_plugin_handler_func
$force_compile
$compile_check
$use_sub_dirs
$allow_ambiguous_resources
$caching
$merge_compiled_includes
$cache_lifetime
$force_cache
$cache_id
$compile_id
$left_delimiter
$right_delimiter
$security_class
$security_policy
$php_handling
$allow_php_templates
$direct_access_security
$debugging
$debugging_ctrl
$smarty_debug_id
$debug_tpl
$error_reporting
$get_used_tags
$config_overwrite
$config_booleanize
$config_read_hidden
$compile_locking
$cache_locking
$locking_timeout
$template_functions
$default_resource_type
$caching_type
$properties
$default_config_type
$template_objects
$cache_modified_check
$registered_plugins
$plugin_search_order
$registered_objects
$registered_classes
$registered_filters
$registered_resources
$_resource_handlers
$registered_cache_resources
$_cacheresource_handlers
$autoload_filters
$default_modifiers
$escape_html
$_smarty_vars
$start_time
$_file_perms
$_dir_perms
$_tag_stack
$smarty
$_current_file
$_parserdebug
$merged_templates_func
$template_class
$tpl_vars
$parent
$config_vars
$_version
SMARTY_VERSION
SCOPE_LOCAL
SCOPE_PARENT
SCOPE_ROOT
SCOPE_GLOBAL
CACHING_OFF
CACHING_LIFETIME_CURRENT
CACHING_LIFETIME_SAVED
COMPILECHECK_OFF
COMPILECHECK_ON
COMPILECHECK_CACHEMISS
PHP_PASSTHRU
PHP_QUOTE
PHP_REMOVE
PHP_ALLOW
FILTER_POST
FILTER_PRE
FILTER_OUTPUT
FILTER_VARIABLE
PLUGIN_FUNCTION
PLUGIN_BLOCK
PLUGIN_COMPILER
PLUGIN_MODIFIER
PLUGIN_MODIFIERCOMPILER
No protected methods found
No protected properties found
N/A
replaceCamelcase()
$template_dir
$compile_dir
$plugins_dir
$cache_dir
$config_dir
N/A

Constants

SMARTY_VERSION

SMARTY_VERSION = 'Smarty-3.1.6'

smarty version

SCOPE_LOCAL

SCOPE_LOCAL = 0

define variable scopes

SCOPE_PARENT

SCOPE_PARENT = 1

SCOPE_ROOT

SCOPE_ROOT = 2

SCOPE_GLOBAL

SCOPE_GLOBAL = 3

CACHING_OFF

CACHING_OFF = 0

define caching modes

CACHING_LIFETIME_CURRENT

CACHING_LIFETIME_CURRENT = 1

CACHING_LIFETIME_SAVED

CACHING_LIFETIME_SAVED = 2

COMPILECHECK_OFF

COMPILECHECK_OFF = 0

define compile check modes

COMPILECHECK_ON

COMPILECHECK_ON = 1

COMPILECHECK_CACHEMISS

COMPILECHECK_CACHEMISS = 2

PHP_PASSTHRU

PHP_PASSTHRU = 0

modes for handling of "<?php .

.. ?>" tags in templates.

PHP_QUOTE

PHP_QUOTE = 1

PHP_REMOVE

PHP_REMOVE = 2

PHP_ALLOW

PHP_ALLOW = 3

FILTER_POST

FILTER_POST = 'post'

filter types

FILTER_PRE

FILTER_PRE = 'pre'

FILTER_OUTPUT

FILTER_OUTPUT = 'output'

FILTER_VARIABLE

FILTER_VARIABLE = 'variable'

PLUGIN_FUNCTION

PLUGIN_FUNCTION = 'function'

plugin types

PLUGIN_BLOCK

PLUGIN_BLOCK = 'block'

PLUGIN_COMPILER

PLUGIN_COMPILER = 'compiler'

PLUGIN_MODIFIER

PLUGIN_MODIFIER = 'modifier'

PLUGIN_MODIFIERCOMPILER

PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'

Properties

$global_tpl_vars

$global_tpl_vars : 

assigned global tpl vars

Type

$_previous_error_handler

$_previous_error_handler : 

error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()

Type

$_muted_directories

$_muted_directories : 

contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()

Type

$auto_literal

$auto_literal : boolean

auto literal on delimiters with whitspace

Type

boolean

$error_unassigned

$error_unassigned : boolean

display error on not assigned variables

Type

boolean

$use_include_path

$use_include_path : boolean

look up relative filepaths in include_path

Type

boolean

$joined_template_dir

$joined_template_dir : string

joined template directory string used in cache keys

Type

string

$joined_config_dir

$joined_config_dir : string

joined config directory string used in cache keys

Type

string

$default_template_handler_func

$default_template_handler_func : callable

default template handler

Type

callable

$default_config_handler_func

$default_config_handler_func : callable

default config handler

Type

callable

$default_plugin_handler_func

$default_plugin_handler_func : callable

default plugin handler

Type

callable

$force_compile

$force_compile : boolean

force template compiling?

Type

boolean

$compile_check

$compile_check : boolean

check template for modifications?

Type

boolean

$use_sub_dirs

$use_sub_dirs : boolean

use sub dirs for compiled/cached files?

Type

boolean

$allow_ambiguous_resources

$allow_ambiguous_resources : boolean

allow ambiguous resources (that are made unique by the resource handler)

Type

boolean

$caching

$caching : boolean

caching enabled

Type

boolean

$merge_compiled_includes

$merge_compiled_includes : boolean

merge compiled includes

Type

boolean

$cache_lifetime

$cache_lifetime : integer

cache lifetime in seconds

Type

integer

$force_cache

$force_cache : boolean

force cache file creation

Type

boolean

$cache_id

$cache_id : string

Set this if you want different sets of cache files for the same templates.

Type

string

$compile_id

$compile_id : string

Set this if you want different sets of compiled files for the same templates.

Type

string

$left_delimiter

$left_delimiter : string

template left-delimiter

Type

string

$right_delimiter

$right_delimiter : string

template right-delimiter

Type

string

$security_class

$security_class : string

class name

This should be instance of Smarty_Security.

Type

string

$security_policy

$security_policy : \Smarty_Security

implementation of security class

Type

\Smarty_Security

$php_handling

$php_handling : integer

controls handling of PHP-blocks

Type

integer

$allow_php_templates

$allow_php_templates : boolean

controls if the php template file resource is allowed

Type

boolean

$direct_access_security

$direct_access_security : boolean

Should compiled-templates be prevented from being called directly?

{@internal Currently used by Smarty_Internal_Template only. }}

Type

boolean

$debugging

$debugging : boolean

debug mode

Setting this to true enables the debug-console.

Type

boolean

$debugging_ctrl

$debugging_ctrl : string

This determines if debugging is enable-able from the browser.

  • NONE => no debugging control allowed
  • URL => enable debugging when SMARTY_DEBUG is found in the URL.

Type

string

$smarty_debug_id

$smarty_debug_id : \type

Name of debugging URL-param.

Only used when $debugging_ctrl is set to 'URL'. The name of the URL-parameter that activates debugging.

Type

\type

$debug_tpl

$debug_tpl : string

Path of debug template.

Type

string

$error_reporting

$error_reporting : integer

When set, smarty uses this value as error_reporting-level.

Type

integer

$get_used_tags

$get_used_tags : boolean

Internal flag for getTags()

Type

boolean

$config_overwrite

$config_overwrite : boolean

Controls whether variables with the same name overwrite each other.

Type

boolean

$config_booleanize

$config_booleanize : boolean

Controls whether config values of on/true/yes and off/false/no get converted to boolean.

Type

boolean

$config_read_hidden

$config_read_hidden : boolean

Controls whether hidden config sections/vars are read from the file.

Type

boolean

$compile_locking

$compile_locking : boolean

locking concurrent compiles

Type

boolean

$cache_locking

$cache_locking : boolean

Controls whether cache resources should emply locking mechanism

Type

boolean

$locking_timeout

$locking_timeout : float

seconds to wait for acquiring a lock before ignoring the write lock

Type

float

$template_functions

$template_functions : array

global template functions

Type

array

$default_resource_type

$default_resource_type : string

resource type used if none given

Must be an valid key of $registered_resources.

Type

string

$caching_type

$caching_type : string

caching type

Must be an element of $cache_resource_types.

Type

string

$properties

$properties : array

internal config properties

Type

array

$default_config_type

$default_config_type : string

config type

Type

string

$template_objects

$template_objects : array

cached template objects

Type

array

$cache_modified_check

$cache_modified_check : boolean

check If-Modified-Since headers

Type

boolean

$registered_plugins

$registered_plugins : array

registered plugins

Type

array

$plugin_search_order

$plugin_search_order : array

plugin search order

Type

array

$registered_objects

$registered_objects : array

registered objects

Type

array

$registered_classes

$registered_classes : array

registered classes

Type

array

$registered_filters

$registered_filters : array

registered filters

Type

array

$registered_resources

$registered_resources : array

registered resources

Type

array

$_resource_handlers

$_resource_handlers : array

resource handler cache

Type

array

$registered_cache_resources

$registered_cache_resources : array

registered cache resources

Type

array

$_cacheresource_handlers

$_cacheresource_handlers : array

cache resource handler cache

Type

array

$autoload_filters

$autoload_filters : array

autoload filter

Type

array

$default_modifiers

$default_modifiers : array

default modifier

Type

array

$escape_html

$escape_html : boolean

autoescape variable output

Type

boolean

$_smarty_vars

$_smarty_vars : array

global internal smarty vars

Type

array

$start_time

$start_time : integer

start time for execution time calculation

Type

integer

$_file_perms

$_file_perms : integer

default file permissions

Type

integer

$_dir_perms

$_dir_perms : integer

default dir permissions

Type

integer

$_tag_stack

$_tag_stack : array

block tag hierarchy

Type

array

$smarty

$smarty : \Smarty

self pointer to Smarty object

Type

\Smarty

$_current_file

$_current_file : string

required by the compiler for BC

Type

string

$_parserdebug

$_parserdebug : boolean

internal flag to enable parser debugging

Type

boolean

$merged_templates_func

$merged_templates_func : array

Saved parameter of merged templates during compilation

Type

array

$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

$_version

$_version : string

Smarty 2 BC

Type

string

$template_dir

$template_dir : array

template directory

Type

array

$compile_dir

$compile_dir : string

compile directory

Type

string

$plugins_dir

$plugins_dir : array

plugins directory

Type

array

$cache_dir

$cache_dir : string

cache directory

Type

string

$config_dir

$config_dir : array

config directory

Type

array

Methods

__construct()

__construct(array  $options = array()) 

Initialize new SmartyBC object

Parameters

array $options

options to set during initialization, e.g. array( 'forceCompile' => false )

__destruct()

__destruct() 

Class destructor

__clone()

__clone() 

<<magic>> set selfpointer on cloned object

__get()

__get(string  $name) : mixed

<<magic>> Generic getter.

Calls the appropriate getter function. Issues an E_USER_NOTICE if no valid getter is found.

Parameters

string $name

property name

Returns

mixed

__set()

__set(string  $name, mixed  $value) 

<<magic>> Generic setter.

Calls the appropriate setter function. Issues an E_USER_NOTICE if no valid setter is found.

Parameters

string $name

property name

mixed $value

parameter passed to setter

templateExists()

templateExists(string  $resource_name) : boolean

Check if a template resource exists

Parameters

string $resource_name

template name

Returns

boolean —

status

getGlobal()

getGlobal(string  $varname = null) : string

Returns a single or all global variables

Parameters

string $varname

variable name or null

Returns

string —

variable value or or array of variables

clearAllCache()

clearAllCache(integer  $exp_time = null, string  $type = null) : integer

Empty cache folder

Parameters

integer $exp_time

expiration time

string $type

resource type

Returns

integer —

number of cache files deleted

clearCache()

clearCache(string  $template_name, string  $cache_id = null, string  $compile_id = null, integer  $exp_time = null, string  $type = null) : integer

Empty cache for a specific template

Parameters

string $template_name

template name

string $cache_id

cache id

string $compile_id

compile id

integer $exp_time

expiration time

string $type

resource type

Returns

integer —

number of cache files deleted

enableSecurity()

enableSecurity(string|\Smarty_Security  $security_class = null) : \Smarty

Loads security class and enables security

Parameters

string|\Smarty_Security $security_class

if a string is used, it must be class-name

Throws

\SmartyException

when an invalid class name is provided

Returns

\Smarty

current Smarty instance for chaining

disableSecurity()

disableSecurity() : \Smarty

Disable security

Returns

\Smarty

current Smarty instance for chaining

setTemplateDir()

setTemplateDir(string|array  $template_dir) : \Smarty

Set template directory

Parameters

string|array $template_dir

directory(s) of template sources

Returns

\Smarty

current Smarty instance for chaining

addTemplateDir()

addTemplateDir(string|array  $template_dir, string  $key = null) : \Smarty

Add template directory(s)

Parameters

string|array $template_dir

directory(s) of template sources

string $key

of the array element to assign the template dir to

Throws

\SmartyException

when the given template directory is not valid

Returns

\Smarty

current Smarty instance for chaining

getTemplateDir()

getTemplateDir(  $index = null) : array|string

Get template directories

Parameters

$index

Returns

array|string —

list of template directories, or directory of $index

setConfigDir()

setConfigDir(  $config_dir) : \Smarty

Set config directory

Parameters

$config_dir

Returns

\Smarty

current Smarty instance for chaining

addConfigDir()

addConfigDir(string|array  $config_dir,   $key = null) : \Smarty

Add config directory(s)

Parameters

string|array $config_dir

directory(s) of config sources

$key

Returns

\Smarty

current Smarty instance for chaining

getConfigDir()

getConfigDir(  $index = null) : array|string

Get config directory

Parameters

$index

Returns

array|string —

configuration directory

setPluginsDir()

setPluginsDir(string|array  $plugins_dir) : \Smarty

Set plugins directory

Parameters

string|array $plugins_dir

directory(s) of plugins

Returns

\Smarty

current Smarty instance for chaining

addPluginsDir()

addPluginsDir(  $plugins_dir) : \Smarty

Adds directory of plugin files

Parameters

$plugins_dir

Returns

\Smarty

current Smarty instance for chaining

getPluginsDir()

getPluginsDir() : array

Get plugin directories

Returns

array —

list of plugin directories

setCompileDir()

setCompileDir(string  $compile_dir) : \Smarty

Set compile directory

Parameters

string $compile_dir

directory to store compiled templates in

Returns

\Smarty

current Smarty instance for chaining

getCompileDir()

getCompileDir() : string

Get compiled directory

Returns

string —

path to compiled templates

setCacheDir()

setCacheDir(string  $cache_dir) : \Smarty

Set cache directory

Parameters

string $cache_dir

directory to store cached templates in

Returns

\Smarty

current Smarty instance for chaining

getCacheDir()

getCacheDir() : string

Get cache directory

Returns

string —

path of cache directory

setDefaultModifiers()

setDefaultModifiers(array|string  $modifiers) : \Smarty

Set default modifiers

Parameters

array|string $modifiers

modifier or list of modifiers to set

Returns

\Smarty

current Smarty instance for chaining

addDefaultModifiers()

addDefaultModifiers(array|string  $modifiers) : \Smarty

Add default modifiers

Parameters

array|string $modifiers

modifier or list of modifiers to add

Returns

\Smarty

current Smarty instance for chaining

getDefaultModifiers()

getDefaultModifiers() : array

Get default modifiers

Returns

array —

list of default modifiers

setAutoloadFilters()

setAutoloadFilters(array  $filters, string  $type = null) : \Smarty

Set autoload filters

Parameters

array $filters

filters to load automatically

string $type

"pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types

Returns

\Smarty

current Smarty instance for chaining

addAutoloadFilters()

addAutoloadFilters(array  $filters, string  $type = null) : \Smarty

Add autoload filters

Parameters

array $filters

filters to load automatically

string $type

"pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types

Returns

\Smarty

current Smarty instance for chaining

getAutoloadFilters()

getAutoloadFilters(string  $type = null) : array

Get autoload filters

Parameters

string $type

type of filter to get autoloads for. Defaults to all autoload filters

Returns

array —

array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified

getDebugTemplate()

getDebugTemplate() : string

return name of debugging template

Returns

string

setDebugTemplate()

setDebugTemplate(string  $tpl_name) : \Smarty

set the debug template

Parameters

string $tpl_name

Throws

\SmartyException

if file is not readable

Returns

\Smarty

current Smarty instance for chaining

createTemplate()

createTemplate(string  $template, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null, boolean  $do_clone = true) : object

creates a template object

Parameters

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

object $parent

next higher level of Smarty variables

boolean $do_clone

flag is Smarty object shall be cloned

Returns

object —

template object

loadPlugin()

loadPlugin(string  $plugin_name, boolean  $check = true) : string

Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName plugin filename format: plugintype.pluginname.php

Parameters

string $plugin_name

class plugin name to load

boolean $check

check if already loaded

Returns

string —

|boolean filepath of loaded file or false

compileAllTemplates()

compileAllTemplates(  $extention = '.tpl', boolean  $force_compile = false, integer  $time_limit, integer  $max_errors = null) : integer

Compile all template files

Parameters

$extention
boolean $force_compile

force all to recompile

integer $time_limit
integer $max_errors

Returns

integer —

number of template files recompiled

compileAllConfig()

compileAllConfig(  $extention = '.conf', boolean  $force_compile = false, integer  $time_limit, integer  $max_errors = null) : integer

Compile all config files

Parameters

$extention
boolean $force_compile

force all to recompile

integer $time_limit
integer $max_errors

Returns

integer —

number of template files recompiled

clearCompiledTemplate()

clearCompiledTemplate(string  $resource_name = null, string  $compile_id = null, integer  $exp_time = null) : integer

Delete compiled template file

Parameters

string $resource_name

template name

string $compile_id

compile id

integer $exp_time

expiration time

Returns

integer —

number of template files deleted

getTags()

getTags(\Smarty_Internal_Template  $template) : array

Return array of tag/attributes of all tags used by an template

Parameters

\Smarty_Internal_Template $template

Returns

array —

of tag/attributes

testInstall()

testInstall(array  $errors = null) : boolean

Run installation test

Parameters

array $errors

Array to write errors into, rather than outputting them

Returns

boolean —

true if setup is fine, false if something is wrong

mutingErrorHandler()

mutingErrorHandler(integer  $errno,   $errstr,   $errfile,   $errline,   $errcontext) : boolean

Error Handler to mute expected messages

Parameters

integer $errno

Error level

$errstr
$errfile
$errline
$errcontext

Returns

boolean

muteExpectedErrors()

muteExpectedErrors() : void

Enable error handler to mute expected messages

unmuteExpectedErrors()

unmuteExpectedErrors() : void

Disable error handler muting expected messages

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

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

assign_by_ref()

assign_by_ref(string  $tpl_var,   $value) 

wrapper for assign_by_ref

Parameters

string $tpl_var

the template variable name

$value

append_by_ref()

append_by_ref(string  $tpl_var,   $value, boolean  $merge = false) 

wrapper for append_by_ref

Parameters

string $tpl_var

the template variable name

$value
boolean $merge

flag if array elements shall be merged

clear_assign()

clear_assign(string  $tpl_var) 

clear the given assigned template variable.

Parameters

string $tpl_var

the template variable to clear

register_function()

register_function(string  $function, string  $function_impl, boolean  $cacheable = true, mixed  $cache_attrs = null) 

Registers custom function to be used in templates

Parameters

string $function

the name of the template function

string $function_impl

the name of the PHP function to register

boolean $cacheable
mixed $cache_attrs

unregister_function()

unregister_function(string  $function) 

Unregisters custom function

Parameters

string $function

name of template function

register_object()

register_object(string  $object, object  $object_impl, array  $allowed = array(), boolean  $smarty_args = true,   $block_methods = array()) 

Registers object to be used in templates

Parameters

string $object

name of template object

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

$block_methods

unregister_object()

unregister_object(string  $object) 

Unregisters object

Parameters

string $object

name of template object

register_block()

register_block(string  $block, string  $block_impl, boolean  $cacheable = true, mixed  $cache_attrs = null) 

Registers block function to be used in templates

Parameters

string $block

name of template block

string $block_impl

PHP function to register

boolean $cacheable
mixed $cache_attrs

unregister_block()

unregister_block(string  $block) 

Unregisters block function

Parameters

string $block

name of template function

register_compiler_function()

register_compiler_function(string  $function, string  $function_impl, boolean  $cacheable = true) 

Registers compiler function

Parameters

string $function

name of template function

string $function_impl

name of PHP function to register

boolean $cacheable

unregister_compiler_function()

unregister_compiler_function(string  $function) 

Unregisters compiler function

Parameters

string $function

name of template function

register_modifier()

register_modifier(string  $modifier, string  $modifier_impl) 

Registers modifier to be used in templates

Parameters

string $modifier

name of template modifier

string $modifier_impl

name of PHP function to register

unregister_modifier()

unregister_modifier(string  $modifier) 

Unregisters modifier

Parameters

string $modifier

name of template modifier

register_resource()

register_resource(string  $type, array  $functions) 

Registers a resource to fetch a template

Parameters

string $type

name of resource

array $functions

array of functions to handle resource

unregister_resource()

unregister_resource(string  $type) 

Unregisters a resource

Parameters

string $type

name of resource

register_prefilter()

register_prefilter(callable  $function) 

Registers a prefilter function to apply to a template before compiling

Parameters

callable $function

unregister_prefilter()

unregister_prefilter(callable  $function) 

Unregisters a prefilter function

Parameters

callable $function

register_postfilter()

register_postfilter(callable  $function) 

Registers a postfilter function to apply to a compiled template after compilation

Parameters

callable $function

unregister_postfilter()

unregister_postfilter(callable  $function) 

Unregisters a postfilter function

Parameters

callable $function

register_outputfilter()

register_outputfilter(callable  $function) 

Registers an output filter function to apply to a template output

Parameters

callable $function

unregister_outputfilter()

unregister_outputfilter(callable  $function) 

Unregisters an outputfilter function

Parameters

callable $function

load_filter()

load_filter(string  $type, string  $name) 

load a filter of specified type and name

Parameters

string $type

filter type

string $name

filter name

clear_cache()

clear_cache(string  $tpl_file = null, string  $cache_id = null, string  $compile_id = null, string  $exp_time = null) : boolean

clear cached content for the given template and cache id

Parameters

string $tpl_file

name of template file

string $cache_id

name of cache_id

string $compile_id

name of compile_id

string $exp_time

expiration time

Returns

boolean

clear_all_cache()

clear_all_cache(string  $exp_time = null) : boolean

clear the entire contents of cache (all templates)

Parameters

string $exp_time

expire time

Returns

boolean

is_cached()

is_cached(string  $tpl_file, string  $cache_id = null, string  $compile_id = null) : boolean

test to see if valid cache exists for this template

Parameters

string $tpl_file

name of template file

string $cache_id
string $compile_id

Returns

boolean

clear_all_assign()

clear_all_assign() 

clear all the assigned template variables.

clear_compiled_tpl()

clear_compiled_tpl(string  $tpl_file = null, string  $compile_id = null, string  $exp_time = null) : boolean

clears compiled version of specified template resource, or all compiled template files if one is not specified.

This function is for advanced use only, not normally needed.

Parameters

string $tpl_file
string $compile_id
string $exp_time

Returns

boolean —

results of {@link smarty_core_rm_auto()}

template_exists()

template_exists(string  $tpl_file) : boolean

Checks whether requested template exists.

Parameters

string $tpl_file

Returns

boolean

get_template_vars()

get_template_vars(string  $name = null) : array

Returns an array containing template variables

Parameters

string $name

Returns

array

get_config_vars()

get_config_vars(string  $name = null) : array

Returns an array containing config variables

Parameters

string $name

Returns

array

config_load()

config_load(string  $file, string  $section = null, string  $scope = 'global') 

load configuration values

Parameters

string $file
string $section
string $scope

get_registered_object()

get_registered_object(string  $name) : object

return a reference to a registered object

Parameters

string $name

Returns

object

clear_config()

clear_config(string  $var = null) 

clear configuration values

Parameters

string $var

trigger_error()

trigger_error(string  $error_msg, integer  $error_type = E_USER_WARNING) 

trigger Smarty error

Parameters

string $error_msg
integer $error_type

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