\Smarty

This is the main Smarty class

Summary

Methods
Properties
Constants
fetch()
display()
isCached()
registerPlugin()
loadFilter()
registerFilter()
registerObject()
setCaching()
setCacheLifetime()
setCompileId()
setCacheId()
__construct()
assign()
append()
assignGlobal()
appendByRef()
assignByRef()
getTemplateVars()
getVariable()
_mergeVars()
_isDataObj()
_isTplObj()
_isSmartyObj()
_getSmartyObj()
__call()
templateExists()
enableSecurity()
disableSecurity()
setTemplateDir()
addTemplateDir()
getTemplateDir()
setConfigDir()
addConfigDir()
getConfigDir()
setPluginsDir()
addPluginsDir()
getPluginsDir()
setCompileDir()
getCompileDir()
setCacheDir()
getCacheDir()
createTemplate()
loadPlugin()
_getTemplateId()
_realpath()
_clearTemplateCache()
setCompileCheck()
setUseSubDirs()
setErrorReporting()
setEscapeHtml()
setAutoLiteral()
setForceCompile()
setMergeCompiledIncludes()
setLeftDelimiter()
setRightDelimiter()
setDebugging()
setConfigOverwrite()
setConfigBooleanize()
setConfigReadHidden()
setCompileLocking()
setDefaultResourceType()
setCachingType()
testInstall()
__get()
__set()
mutingErrorHandler()
muteExpectedErrors()
unmuteExpectedErrors()
clearAllCache()
clearCache()
compileAllTemplates()
compileAllConfig()
clearCompiledTemplate()
addAutoloadFilters()
addDefaultModifier()
createData()
getAutoloadFilters()
getDebugTemplate()
getDefaultModifier()
getTags()
getRegisteredObject()
registerCacheResource()
registerClass()
registerDefaultConfigHandler()
registerDefaultPluginHandler()
registerDefaultTemplateHandler()
registerResource()
setAutoloadFilters()
setDebugTemplate()
setDefaultModifier()
unloadFilter()
unregisterCacheResource()
unregisterObject()
unregisterPlugin()
unregisterFilter()
unregisterResource()
_getSmartyObj()
getConfigVariable()
getConfigVars()
getGlobal()
getStreamVariable()
clearAssign()
clearAllAssign()
clearConfig()
configLoad()
$cache_id
$compile_id
$caching
$cache_lifetime
$tplFunctions
$_cache
$_objType
$template_class
$tpl_vars
$parent
$config_vars
$ext
$global_tpl_vars
$_previous_error_handler
$_muted_directories
$_MBSTRING
$_CHARSET
$_DATE_FORMAT
$_UTF8_MODIFIER
$_IS_WINDOWS
$auto_literal
$error_unassigned
$use_include_path
$_templateDirNormalized
$_joined_template_dir
$_configDirNormalized
$_joined_config_dir
$default_template_handler_func
$default_config_handler_func
$default_plugin_handler_func
$_compileDirNormalized
$_pluginsDirNormalized
$_cacheDirNormalized
$force_compile
$compile_check
$use_sub_dirs
$allow_ambiguous_resources
$merge_compiled_includes
$extends_recursion
$force_cache
$left_delimiter
$right_delimiter
$security_class
$security_policy
$php_handling
$allow_php_templates
$debugging
$debugging_ctrl
$smarty_debug_id
$debug_tpl
$error_reporting
$config_overwrite
$config_booleanize
$config_read_hidden
$compile_locking
$cache_locking
$locking_timeout
$default_resource_type
$caching_type
$default_config_type
$cache_modified_check
$registered_plugins
$registered_objects
$registered_classes
$registered_filters
$registered_resources
$registered_cache_resources
$autoload_filters
$default_modifiers
$escape_html
$start_time
$_current_file
$_parserdebug
$_debug
$ds
$_objType
$scope
$smarty
SMARTY_VERSION
SCOPE_LOCAL
SCOPE_PARENT
SCOPE_TPL_ROOT
SCOPE_ROOT
SCOPE_SMARTY
SCOPE_GLOBAL
CACHING_OFF
CACHING_LIFETIME_CURRENT
CACHING_LIFETIME_SAVED
CLEAR_EXPIRED
COMPILECHECK_OFF
COMPILECHECK_ON
COMPILECHECK_CACHEMISS
DEBUG_OFF
DEBUG_ON
DEBUG_INDIVIDUAL
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
RESOURCE_CACHE_OFF
RESOURCE_CACHE_AUTOMATIC
RESOURCE_CACHE_TEMPLATE
RESOURCE_CACHE_ON
No protected methods found
$template_dir
$_processedTemplateDir
$config_dir
$_processedConfigDir
$compile_dir
$plugins_dir
$cache_dir
N/A
_execute()
_normalizeDir()
_nomalizeTemplateConfig()
$obsoleteProperties
$accessMap
N/A

Constants

SMARTY_VERSION

SMARTY_VERSION = '3.1.31'

smarty version

SCOPE_LOCAL

SCOPE_LOCAL = 1

define variable scopes

SCOPE_PARENT

SCOPE_PARENT = 2

SCOPE_TPL_ROOT

SCOPE_TPL_ROOT = 4

SCOPE_ROOT

SCOPE_ROOT = 8

SCOPE_SMARTY

SCOPE_SMARTY = 16

SCOPE_GLOBAL

SCOPE_GLOBAL = 32

CACHING_OFF

CACHING_OFF = 0

define caching modes

CACHING_LIFETIME_CURRENT

CACHING_LIFETIME_CURRENT = 1

CACHING_LIFETIME_SAVED

CACHING_LIFETIME_SAVED = 2

CLEAR_EXPIRED

CLEAR_EXPIRED = -1

define constant for clearing cache files be saved expiration dates

COMPILECHECK_OFF

COMPILECHECK_OFF = 0

define compile check modes

COMPILECHECK_ON

COMPILECHECK_ON = 1

COMPILECHECK_CACHEMISS

COMPILECHECK_CACHEMISS = 2

DEBUG_OFF

DEBUG_OFF = 0

define debug modes

DEBUG_ON

DEBUG_ON = 1

DEBUG_INDIVIDUAL

DEBUG_INDIVIDUAL = 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'

RESOURCE_CACHE_OFF

RESOURCE_CACHE_OFF = 0

Resource caching modes (not used since 3.1.30)

RESOURCE_CACHE_AUTOMATIC

RESOURCE_CACHE_AUTOMATIC = 1

RESOURCE_CACHE_TEMPLATE

RESOURCE_CACHE_TEMPLATE = 2

RESOURCE_CACHE_ON

RESOURCE_CACHE_ON = 4

Properties

$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

$caching

$caching : boolean

caching enabled

Type

boolean

$cache_lifetime

$cache_lifetime : integer

cache lifetime in seconds

Type

integer

$tplFunctions

$tplFunctions : array

Array of source information for known template functions

Type

array

$_cache

$_cache : \array()

universal cache

Type

\array()

$_objType

$_objType : integer

This object type (Smarty = 1, template = 2, data = 4)

Type

integer

$template_class

$template_class : string

name of class used for templates

Type

string

$tpl_vars

$tpl_vars : array<mixed,\Smarty_Variable>

template variables

Type

array<mixed,\Smarty_Variable>

$config_vars

$config_vars : array<mixed,string>

configuration settings

Type

array<mixed,string>

$global_tpl_vars

$global_tpl_vars : 

assigned global tpl vars

Type

$_previous_error_handler

$_previous_error_handler : 

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

Type

$_muted_directories

$_muted_directories : 

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

Type

$_MBSTRING

$_MBSTRING : 

Flag denoting if Multibyte String functions are available

Type

$_CHARSET

$_CHARSET : 

The character set to adhere to (e.g. "UTF-8")

Type

$_DATE_FORMAT

$_DATE_FORMAT : 

The date format to be used internally (accepts date() and strftime())

Type

$_UTF8_MODIFIER

$_UTF8_MODIFIER : 

Flag denoting if PCRE should run in UTF-8 mode

Type

$_IS_WINDOWS

$_IS_WINDOWS : 

Flag denoting if operating system is windows

Type

$auto_literal

$auto_literal : boolean

auto literal on delimiters with whitespace

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 file path in include_path

Type

boolean

$_templateDirNormalized

$_templateDirNormalized : boolean

flag if template_dir is normalized

Type

boolean

$_joined_template_dir

$_joined_template_dir : string

joined template directory string used in cache keys

Type

string

$_configDirNormalized

$_configDirNormalized : boolean

flag if config_dir is normalized

Type

boolean

$_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

$_compileDirNormalized

$_compileDirNormalized : boolean

flag if template_dir is normalized

Type

boolean

$_pluginsDirNormalized

$_pluginsDirNormalized : boolean

flag if plugins_dir is normalized

Type

boolean

$_cacheDirNormalized

$_cacheDirNormalized : boolean

flag if template_dir is normalized

Type

boolean

$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

$merge_compiled_includes

$merge_compiled_includes : boolean

merge compiled includes

Type

boolean

$extends_recursion

$extends_recursion : 

Type

$force_cache

$force_cache : boolean

force cache file creation

Type

boolean

$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

$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 : string

Name of debugging URL-param.

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

Type

string

$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

$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 use locking mechanism

Type

boolean

$locking_timeout

$locking_timeout : float

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

Type

float

$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

$default_config_type

$default_config_type : string

config type

Type

string

$cache_modified_check

$cache_modified_check : boolean

check If-Modified-Since headers

Type

boolean

$registered_plugins

$registered_plugins : array

registered plugins

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

$registered_cache_resources

$registered_cache_resources : array

registered cache resources

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

$start_time

$start_time : integer

start time for execution time calculation

Type

integer

$_current_file

$_current_file : string

required by the compiler for BC

Type

string

$_parserdebug

$_parserdebug : boolean

internal flag to enable parser debugging

Type

boolean

$ds

$ds : string

Directory separator

Type

string

$_objType

$_objType : integer

This object type (Smarty = 1, template = 2, data = 4)

The following methods will be dynamically loaded by the extension handler when they are called. They are located in a corresponding Smarty_Internal_Method_xxxx class

Type

integer

$scope

$scope : integer

Type

integer

$smarty

$smarty : \Smarty

The following methods will be dynamically loaded by the extension handler when they are called. They are located in a corresponding Smarty_Internal_Method_xxxx class

Type

\Smarty

$template_dir

$template_dir : array

template directory

Type

array

$_processedTemplateDir

$_processedTemplateDir : array

flags for normalized template directory entries

Type

array

$config_dir

$config_dir : array

config directory

Type

array

$_processedConfigDir

$_processedConfigDir : array

flags for normalized template directory entries

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

$obsoleteProperties

$obsoleteProperties : array<mixed,string>

removed properties

Type

array<mixed,string>

$accessMap

$accessMap : array<mixed,string>

List of private properties which will call getter/setter on a direct access

Type

array<mixed,string>

Methods

fetch()

fetch(string  $template = null, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null) : 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

Throws

\Exception
\SmartyException

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(null|string|\Smarty_Internal_Template  $template = null, mixed  $cache_id = null, mixed  $compile_id = null, object  $parent = null) : boolean

test if cache is valid

Parameters

null|string|\Smarty_Internal_Template $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

registerPlugin()

registerPlugin(string  $type, string  $name, callback  $callback, boolean  $cacheable = true, mixed  $cache_attr = null) : \Smarty|\Smarty_Internal_Template

Registers plugin to be used in templates

Parameters

string $type

plugin type

string $name

name of template tag

callback $callback

PHP callback to register

boolean $cacheable

if true (default) this function is cache able

mixed $cache_attr

caching attributes if any

Throws

\SmartyException

when the plugin tag is invalid

Returns

\Smarty|\Smarty_Internal_Template

loadFilter()

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

load a filter of specified type and name

Parameters

string $type

filter type

string $name

filter name

Throws

\SmartyException

if filter could not be loaded

Returns

boolean

registerFilter()

registerFilter(string  $type, callback  $callback, string|null  $name = null) : \Smarty|\Smarty_Internal_Template

Registers a filter function

Parameters

string $type

filter type

callback $callback
string|null $name

optional filter name

Throws

\SmartyException

Returns

\Smarty|\Smarty_Internal_Template

registerObject()

registerObject(string  $object_name, object  $object, array  $allowed_methods_properties = array(), boolean  $format = true, array  $block_methods = array()) : \Smarty|\Smarty_Internal_Template

Registers object to be used in templates

Parameters

string $object_name
object $object

the referenced PHP object to register

array $allowed_methods_properties

list of allowed methods (empty = all)

boolean $format

smarty argument format, else traditional

array $block_methods

list of block-methods

Throws

\SmartyException

Returns

\Smarty|\Smarty_Internal_Template

setCaching()

setCaching(boolean  $caching) 

Parameters

boolean $caching

setCacheLifetime()

setCacheLifetime(integer  $cache_lifetime) 

Parameters

integer $cache_lifetime

setCompileId()

setCompileId(string  $compile_id) 

Parameters

string $compile_id

setCacheId()

setCacheId(string  $cache_id) 

Parameters

string $cache_id

__construct()

__construct() 

Initialize new Smarty object

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

append()

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

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|\Smarty_Internal_Template|\Smarty

assignGlobal()

assignGlobal(string  $varName, mixed  $value = null, boolean  $nocache = false) : \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty

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|\Smarty_Internal_Template|\Smarty

appendByRef()

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

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|\Smarty_Internal_Template|\Smarty

assignByRef()

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

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|\Smarty_Internal_Template|\Smarty

getTemplateVars()

getTemplateVars(string  $varName = null, \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty  $_ptr = null, boolean  $searchParents = true) : mixed

Returns a single or all template variables

Parameters

string $varName

variable name or null

\Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr

optional pointer to data object

boolean $searchParents

include parent templates?

Returns

mixed —

variable value or or array of variables

getVariable()

getVariable(string  $variable = null, \Smarty_Internal_Data  $_ptr = null, boolean  $searchParents = true, boolean  $error_enable = true) : \Smarty_Variable|\Smarty_Undefined_Variable

gets the object of a Smarty variable

Parameters

string $variable

the name of the Smarty variable

\Smarty_Internal_Data $_ptr

optional pointer to data object

boolean $searchParents

search also in parent data

boolean $error_enable

Returns

\Smarty_Variable|\Smarty_Undefined_Variable

the object of the variable

_mergeVars()

_mergeVars(\Smarty_Internal_Data|null  $data = null) 

Follow the parent chain an merge template and config variables

Parameters

\Smarty_Internal_Data|null $data

_isDataObj()

_isDataObj() : boolean

Return true if this instance is a Data obj

Returns

boolean

_isTplObj()

_isTplObj() : boolean

Return true if this instance is a template obj

Returns

boolean

_isSmartyObj()

_isSmartyObj() : boolean

Return true if this instance is a Smarty obj

Returns

boolean

_getSmartyObj()

_getSmartyObj() : \Smarty

Get Smarty object

Returns

\Smarty

__call()

__call(string  $name, array  $args) : mixed

Handle unknown class methods

Parameters

string $name

unknown method-name

array $args

argument array

Throws

\SmartyException

Returns

mixed

templateExists()

templateExists(string  $resource_name) : boolean

Check if a template resource exists

Parameters

string $resource_name

template name

Returns

boolean —

status

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, boolean  $isConfig = false) : \Smarty

Set template directory

Parameters

string|array $template_dir

directory(s) of template sources

boolean $isConfig

true for config_dir

Returns

\Smarty

current Smarty instance for chaining

addTemplateDir()

addTemplateDir(string|array  $template_dir, string  $key = null, boolean  $isConfig = false) : \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

boolean $isConfig

true for config_dir

Returns

\Smarty

current Smarty instance for chaining

getTemplateDir()

getTemplateDir(mixed  $index = null, boolean  $isConfig = false) : array

Get template directories

Parameters

mixed $index

index of directory to get, null to get all

boolean $isConfig

true for config_dir

Returns

array —

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, mixed  $key = null) : \Smarty

Add config directory(s)

Parameters

string|array $config_dir

directory(s) of config sources

mixed $key

key of the array element to assign the config dir to

Returns

\Smarty

current Smarty instance for chaining

getConfigDir()

getConfigDir(mixed  $index = null) : array

Get config directory

Parameters

mixed $index

index of directory to get, null to get all

Returns

array —

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(null|array  $plugins_dir) : \Smarty

Adds directory of plugin files

Parameters

null|array $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

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

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

Throws

\SmartyException

Returns

string —

|boolean filepath of loaded file or false

_getTemplateId()

_getTemplateId(string  $template_name, null|mixed  $cache_id = null, null|mixed  $compile_id = null, null  $caching = null, \Smarty_Internal_Template  $template = null) : string

Get unique template id

Parameters

string $template_name
null|mixed $cache_id
null|mixed $compile_id
null $caching
\Smarty_Internal_Template $template

Returns

string

_realpath()

_realpath(string  $path, boolean  $realpath = null) : string

Normalize path - remove /./ and /.

./

  • make it absolute if required

Parameters

string $path

file path

boolean $realpath

if true - convert to absolute false - convert to relative null - keep as it is but remove /./ /../

Returns

string

_clearTemplateCache()

_clearTemplateCache() 

Empty template objects cache

setCompileCheck()

setCompileCheck(boolean  $compile_check) 

Parameters

boolean $compile_check

setUseSubDirs()

setUseSubDirs(boolean  $use_sub_dirs) 

Parameters

boolean $use_sub_dirs

setErrorReporting()

setErrorReporting(integer  $error_reporting) 

Parameters

integer $error_reporting

setEscapeHtml()

setEscapeHtml(boolean  $escape_html) 

Parameters

boolean $escape_html

setAutoLiteral()

setAutoLiteral(boolean  $auto_literal) 

Parameters

boolean $auto_literal

setForceCompile()

setForceCompile(boolean  $force_compile) 

Parameters

boolean $force_compile

setMergeCompiledIncludes()

setMergeCompiledIncludes(boolean  $merge_compiled_includes) 

Parameters

boolean $merge_compiled_includes

setLeftDelimiter()

setLeftDelimiter(string  $left_delimiter) 

Parameters

string $left_delimiter

setRightDelimiter()

setRightDelimiter(string  $right_delimiter) 

Parameters

string $right_delimiter

setDebugging()

setDebugging(boolean  $debugging) 

Parameters

boolean $debugging

setConfigOverwrite()

setConfigOverwrite(boolean  $config_overwrite) 

Parameters

boolean $config_overwrite

setConfigBooleanize()

setConfigBooleanize(boolean  $config_booleanize) 

Parameters

boolean $config_booleanize

setConfigReadHidden()

setConfigReadHidden(boolean  $config_read_hidden) 

Parameters

boolean $config_read_hidden

setCompileLocking()

setCompileLocking(boolean  $compile_locking) 

Parameters

boolean $compile_locking

setDefaultResourceType()

setDefaultResourceType(string  $default_resource_type) 

Parameters

string $default_resource_type

setCachingType()

setCachingType(string  $caching_type) 

Parameters

string $caching_type

testInstall()

testInstall(null  $errors = null) 

Test install

Parameters

null $errors

__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

mutingErrorHandler()

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

Error Handler to mute expected messages

Parameters

integer $errno

Error level

$errstr
$errfile
$errline
$errcontext

Returns

boolean|void

muteExpectedErrors()

muteExpectedErrors() : void

Enable error handler to mute expected messages

unmuteExpectedErrors()

unmuteExpectedErrors() : void

Disable error handler muting expected messages

clearAllCache()

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

Parameters

integer $exp_time
string $type

Returns

integer

clearCache()

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

Parameters

string $template_name
string $cache_id
string $compile_id
integer $exp_time
string $type

Returns

integer

compileAllTemplates()

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

Parameters

string $extension
boolean $force_compile
integer $time_limit
integer $max_errors

Returns

integer

compileAllConfig()

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

Parameters

string $extension
boolean $force_compile
integer $time_limit
integer $max_errors

Returns

integer

clearCompiledTemplate()

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

Parameters

mixed $resource_name
mixed $compile_id
mixed $exp_time

Returns

integer

addAutoloadFilters()

addAutoloadFilters(mixed  $filters, string  $type = null) : \Smarty_Internal_TemplateBase

Parameters

mixed $filters
string $type

Returns

\Smarty_Internal_TemplateBase

addDefaultModifier()

addDefaultModifier(mixed  $modifiers) : \Smarty_Internal_TemplateBase

Parameters

mixed $modifiers

Returns

\Smarty_Internal_TemplateBase

createData()

createData(\Smarty_Internal_Data  $parent = null, string  $name = null) : \Smarty_Internal_TemplateBase

Parameters

\Smarty_Internal_Data $parent
string $name

Returns

\Smarty_Internal_TemplateBase

getAutoloadFilters()

getAutoloadFilters(string  $type = null) : array

Parameters

string $type

Returns

array

getDebugTemplate()

getDebugTemplate() : string

Returns

string

getDefaultModifier()

getDefaultModifier() : array

Returns

array

getTags()

getTags(mixed  $template = null) : array

Parameters

mixed $template

Returns

array

getRegisteredObject()

getRegisteredObject(string  $object_name) : object

Parameters

string $object_name

Returns

object

registerCacheResource()

registerCacheResource(string  $name, \Smarty_CacheResource  $resource_handler) : \Smarty_Internal_TemplateBase

Parameters

string $name
\Smarty_CacheResource $resource_handler

Returns

\Smarty_Internal_TemplateBase

registerClass()

registerClass(string  $class_name, string  $class_impl) : \Smarty_Internal_TemplateBase

Parameters

string $class_name
string $class_impl

Returns

\Smarty_Internal_TemplateBase

registerDefaultConfigHandler()

registerDefaultConfigHandler(callback  $callback) : \Smarty_Internal_TemplateBase

Parameters

callback $callback

Returns

\Smarty_Internal_TemplateBase

registerDefaultPluginHandler()

registerDefaultPluginHandler(callback  $callback) : \Smarty_Internal_TemplateBase

Parameters

callback $callback

Returns

\Smarty_Internal_TemplateBase

registerDefaultTemplateHandler()

registerDefaultTemplateHandler(callback  $callback) : \Smarty_Internal_TemplateBase

Parameters

callback $callback

Returns

\Smarty_Internal_TemplateBase

registerResource()

registerResource(string  $name, mixed  $resource_handler) : \Smarty_Internal_TemplateBase

Parameters

string $name
mixed $resource_handler

Returns

\Smarty_Internal_TemplateBase

setAutoloadFilters()

setAutoloadFilters(mixed  $filters, string  $type = null) : \Smarty_Internal_TemplateBase

Parameters

mixed $filters
string $type

Returns

\Smarty_Internal_TemplateBase

setDebugTemplate()

setDebugTemplate(string  $tpl_name) : \Smarty_Internal_TemplateBase

Parameters

string $tpl_name

Returns

\Smarty_Internal_TemplateBase

setDefaultModifier()

setDefaultModifier(mixed  $modifiers) : \Smarty_Internal_TemplateBase

Parameters

mixed $modifiers

Returns

\Smarty_Internal_TemplateBase

unloadFilter()

unloadFilter(string  $type, string  $name) : \Smarty_Internal_TemplateBase

Parameters

string $type
string $name

Returns

\Smarty_Internal_TemplateBase

unregisterCacheResource()

unregisterCacheResource(string  $name) : \Smarty_Internal_TemplateBase

Parameters

string $name

Returns

\Smarty_Internal_TemplateBase

unregisterObject()

unregisterObject(string  $object_name) : \Smarty_Internal_TemplateBase

Parameters

string $object_name

Returns

\Smarty_Internal_TemplateBase

unregisterPlugin()

unregisterPlugin(string  $type, string  $name) : \Smarty_Internal_TemplateBase

Parameters

string $type
string $name

Returns

\Smarty_Internal_TemplateBase

unregisterFilter()

unregisterFilter(string  $type, mixed  $callback) : \Smarty_Internal_TemplateBase

Parameters

string $type
mixed $callback

Returns

\Smarty_Internal_TemplateBase

unregisterResource()

unregisterResource(string  $name) : \Smarty_Internal_TemplateBase

Parameters

string $name

Returns

\Smarty_Internal_TemplateBase

_getSmartyObj()

_getSmartyObj() : \Smarty

Get Smarty object

Returns

\Smarty

getConfigVariable()

getConfigVariable(string  $varName, boolean  $errorEnable = true) : mixed

Parameters

string $varName
boolean $errorEnable

Returns

mixed

getConfigVars()

getConfigVars(string  $varName = null, boolean  $searchParents = true) : mixed

Parameters

string $varName
boolean $searchParents

Returns

mixed

getGlobal()

getGlobal(string  $varName = null) : mixed

Parameters

string $varName

Returns

mixed

getStreamVariable()

getStreamVariable(string  $variable) : mixed

Parameters

string $variable

Returns

mixed

clearAssign()

clearAssign(mixed  $tpl_var) : \Smarty_Internal_Data

Parameters

mixed $tpl_var

Returns

\Smarty_Internal_Data

clearAllAssign()

clearAllAssign() : \Smarty_Internal_Data

Returns

\Smarty_Internal_Data

clearConfig()

clearConfig(string  $varName = null) : \Smarty_Internal_Data

Parameters

string $varName

Returns

\Smarty_Internal_Data

configLoad()

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

Parameters

string $config_file
mixed $sections
string $scope

Returns

\Smarty_Internal_Data

_execute()

_execute(string  $template, mixed  $cache_id, mixed  $compile_id, object  $parent, string  $function) : mixed

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

string $function

function type 0 = fetch, 1 = display, 2 = isCache

Throws

\Exception
\SmartyException

Returns

mixed

_normalizeDir()

_normalizeDir(string  $dirName, string  $dir) 

Normalize and set directory string

Parameters

string $dirName

cache_dir or compile_dir

string $dir

filepath of folder

_nomalizeTemplateConfig()

_nomalizeTemplateConfig(boolean  $isConfig) 

Normalize template_dir or config_dir

Parameters

boolean $isConfig

true for config_dir