Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Smarty
  • SmartyBC

Interfaces

  • SmartyCompilerException
  • SmartyException

Functions

  • smarty_php_tag
  • smartyAutoload
  • Overview
  • Package
  • Class
  • Todo
  • Download

Class Smarty

This is the main Smarty class

Smarty_Internal_Data
Extended by Smarty_Internal_TemplateBase
Extended by Smarty

Direct known subclasses

cSmartyWrapper, SmartyBC
Package: Smarty
Copyright: 2008 New Digital Group, Inc.
Author: Monte Ohrt
Author: Uwe Tews
Author: Rodney Rehm
Located at plugins/smarty/smarty_source/Smarty.class.php
Methods summary
public
# __construct( )

Initialize new Smarty object

Initialize new Smarty object

public
# __destruct( )

Class destructor

Class destructor

public
# __clone( )

<> set selfpointer on cloned object

<> set selfpointer on cloned object

public mixed
# __get( string $name )

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

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

Parameters

$name
property name

Returns

mixed
public
# __set( string $name, mixed $value )

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

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

Parameters

$name
property name
$value
parameter passed to setter
public boolean
# templateExists( string $resource_name )

Check if a template resource exists

Check if a template resource exists

Parameters

$resource_name
template name

Returns

boolean
status
public string
# getGlobal( string $varname = null )

Returns a single or all global variables

Returns a single or all global variables

Parameters

$varname
variable name or null

Returns

string
variable value or or array of variables
public integer
# clearAllCache( integer $exp_time = null, string $type = null )

Empty cache folder

Empty cache folder

Parameters

$exp_time
expiration time
$type
resource type

Returns

integer
number of cache files deleted
public integer
# clearCache( string $template_name, string $cache_id = null, string $compile_id = null, integer $exp_time = null, string $type = null )

Empty cache for a specific template

Empty cache for a specific template

Parameters

$template_name
template name
$cache_id
cache id
$compile_id
compile id
$exp_time
expiration time
$type
resource type

Returns

integer
number of cache files deleted
public Smarty
# enableSecurity( string|Smarty_Security $security_class = null )

Loads security class and enables security

Loads security class and enables security

Parameters

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

Returns

Smarty
current Smarty instance for chaining

Throws

SmartyException
when an invalid class name is provided
public Smarty
# disableSecurity( )

Disable security

Disable security

Returns

Smarty
current Smarty instance for chaining
public Smarty
# setTemplateDir( string|array $template_dir )

Set template directory

Set template directory

Parameters

$template_dir
directory(s) of template sources

Returns

Smarty
current Smarty instance for chaining
public Smarty
# addTemplateDir( string|array $template_dir, string $key = null )

Add template directory(s)

Add template directory(s)

Parameters

$template_dir
directory(s) of template sources
$key
of the array element to assign the template dir to

Returns

Smarty
current Smarty instance for chaining

Throws

SmartyException
when the given template directory is not valid
public array|string
# getTemplateDir( mixed $index = null )

Get template directories

Get template directories

Parameters

$index
index of directory to get, null to get all

Returns

array|string
list of template directories, or directory of $index
public Smarty
# setConfigDir( $config_dir )

Set config directory

Set config directory

Parameters

$config_dir

Returns

Smarty
current Smarty instance for chaining
public Smarty
# addConfigDir( string|array $config_dir, mixed $key = null )

Add config directory(s)

Add config directory(s)

Parameters

$config_dir
directory(s) of config sources
$key
key of the array element to assign the config dir to

Returns

Smarty
current Smarty instance for chaining
public array|string
# getConfigDir( mixed $index = null )

Get config directory

Get config directory

Parameters

$index
index of directory to get, null to get all

Returns

array|string
configuration directory
public Smarty
# setPluginsDir( string|array $plugins_dir )

Set plugins directory

Set plugins directory

Parameters

$plugins_dir
directory(s) of plugins

Returns

Smarty
current Smarty instance for chaining
public Smarty
# addPluginsDir( $plugins_dir )

Adds directory of plugin files

Adds directory of plugin files

Parameters

$plugins_dir

Returns

Smarty
current Smarty instance for chaining
public array
# getPluginsDir( )

Get plugin directories

Get plugin directories

Returns

array
list of plugin directories
public Smarty
# setCompileDir( string $compile_dir )

Set compile directory

Set compile directory

Parameters

$compile_dir
directory to store compiled templates in

Returns

Smarty
current Smarty instance for chaining
public string
# getCompileDir( )

Get compiled directory

Get compiled directory

Returns

string
path to compiled templates
public Smarty
# setCacheDir( string $cache_dir )

Set cache directory

Set cache directory

Parameters

$cache_dir
directory to store cached templates in

Returns

Smarty
current Smarty instance for chaining
public string
# getCacheDir( )

Get cache directory

Get cache directory

Returns

string
path of cache directory
public Smarty
# setDefaultModifiers( array|string $modifiers )

Set default modifiers

Set default modifiers

Parameters

$modifiers
modifier or list of modifiers to set

Returns

Smarty
current Smarty instance for chaining
public Smarty
# addDefaultModifiers( array|string $modifiers )

Add default modifiers

Add default modifiers

Parameters

$modifiers
modifier or list of modifiers to add

Returns

Smarty
current Smarty instance for chaining
public array
# getDefaultModifiers( )

Get default modifiers

Get default modifiers

Returns

array
list of default modifiers
public Smarty
# setAutoloadFilters( array $filters, string $type = null )

Set autoload filters

Set autoload filters

Parameters

$filters
filters to load automatically
$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
public Smarty
# addAutoloadFilters( array $filters, string $type = null )

Add autoload filters

Add autoload filters

Parameters

$filters
filters to load automatically
$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
public array
# getAutoloadFilters( string $type = null )

Get autoload filters

Get autoload filters

Parameters

$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
public string
# getDebugTemplate( )

return name of debugging template

return name of debugging template

Returns

string
public Smarty
# setDebugTemplate( string $tpl_name )

set the debug template

set the debug template

Parameters

$tpl_name

Returns

Smarty
current Smarty instance for chaining

Throws

SmartyException
if file is not readable
public object
# createTemplate( string $template, mixed $cache_id = null, mixed $compile_id = null, object $parent = null, boolean $do_clone = true )

creates a template object

creates a template object

Parameters

$template
the resource handle of the template file
$cache_id
cache id to be used with this template
$compile_id
compile id to be used with this template
$parent
next higher level of Smarty variables
$do_clone
flag is Smarty object shall be cloned

Returns

object
template object
public string
# loadPlugin( string $plugin_name, boolean $check = true )

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

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

Parameters

$plugin_name
class plugin name to load
$check
check if already loaded

Returns

string
|boolean filepath of loaded file or false

Throws

SmartyException
public integer
# compileAllTemplates( string $extension = '.tpl', boolean $force_compile = false, integer $time_limit = 0, integer $max_errors = null )

Compile all template files

Compile all template files

Parameters

$extension
file extension
$force_compile
force all to recompile
$time_limit
$max_errors

Returns

integer
number of template files recompiled
public integer
# compileAllConfig( string $extension = '.conf', boolean $force_compile = false, integer $time_limit = 0, integer $max_errors = null )

Compile all config files

Compile all config files

Parameters

$extension
file extension
$force_compile
force all to recompile
$time_limit
$max_errors

Returns

integer
number of template files recompiled
public integer
# clearCompiledTemplate( string $resource_name = null, string $compile_id = null, integer $exp_time = null )

Delete compiled template file

Delete compiled template file

Parameters

$resource_name
template name
$compile_id
compile id
$exp_time
expiration time

Returns

integer
number of template files deleted
public array
# getTags( Smarty_Internal_Template $template )

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

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

Parameters

$template

Returns

array
of tag/attributes
public boolean
# testInstall( array & $errors = null )

Run installation test

Run installation test

Parameters

$errors
Array to write errors into, rather than outputting them

Returns

boolean
true if setup is fine, false if something is wrong
public static boolean
# mutingErrorHandler( integer $errno, $errstr, $errfile, $errline, $errcontext )

Error Handler to mute expected messages

Error Handler to mute expected messages

Parameters

$errno
Error level
$errstr
$errfile
$errline
$errcontext

Returns

boolean

Link

http://php.net/set_error_handler
public static
# muteExpectedErrors( )

Enable error handler to mute expected messages

Enable error handler to mute expected messages

public static
# unmuteExpectedErrors( )

Disable error handler muting expected messages

Disable error handler muting expected messages

Methods inherited from Smarty_Internal_TemplateBase
__call(), _get_filter_name(), createData(), display(), fetch(), getRegisteredObject(), isCached(), loadFilter(), registerCacheResource(), registerClass(), registerDefaultConfigHandler(), registerDefaultPluginHandler(), registerDefaultTemplateHandler(), registerFilter(), registerObject(), registerPlugin(), registerResource(), unloadFilter(), unregisterCacheResource(), unregisterFilter(), unregisterObject(), unregisterPlugin(), unregisterResource()
Methods inherited from Smarty_Internal_Data
append(), appendByRef(), assign(), assignByRef(), assignGlobal(), clearAllAssign(), clearAssign(), clearConfig(), configLoad(), getConfigVariable(), getConfigVars(), getStreamVariable(), getTemplateVars(), getVariable()
Constants summary
string SMARTY_VERSION

smarty version

smarty version

# 'Smarty-3.1.21-dev'
integer SCOPE_LOCAL

define variable scopes

define variable scopes

# 0
integer SCOPE_PARENT
# 1
integer SCOPE_ROOT
# 2
integer SCOPE_GLOBAL
# 3
integer CACHING_OFF

define caching modes

define caching modes

# 0
integer CACHING_LIFETIME_CURRENT
# 1
integer CACHING_LIFETIME_SAVED
# 2
integer CLEAR_EXPIRED

define constant for clearing cache files be saved expiration datees

define constant for clearing cache files be saved expiration datees

# -1
integer COMPILECHECK_OFF

define compile check modes

define compile check modes

# 0
integer COMPILECHECK_ON
# 1
integer COMPILECHECK_CACHEMISS
# 2
integer PHP_PASSTHRU

modes for handling of "" tags in templates.

modes for handling of "" tags in templates.

# 0
integer PHP_QUOTE
# 1
integer PHP_REMOVE
# 2
integer PHP_ALLOW
# 3
string FILTER_POST

filter types

filter types

# 'post'
string FILTER_PRE
# 'pre'
string FILTER_OUTPUT
# 'output'
string FILTER_VARIABLE
# 'variable'
string PLUGIN_FUNCTION

plugin types

plugin types

# 'function'
string PLUGIN_BLOCK
# 'block'
string PLUGIN_COMPILER
# 'compiler'
string PLUGIN_MODIFIER
# 'modifier'
string PLUGIN_MODIFIERCOMPILER
# 'modifiercompiler'
Properties summary
public static array $global_tpl_vars

assigned global tpl vars

assigned global tpl vars

# array()
public static $_previous_error_handler

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

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

# null
public static array $_muted_directories

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

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

# array()
public static $_MBSTRING

Flag denoting if Multibyte String functions are available

Flag denoting if Multibyte String functions are available

# SMARTY_MBSTRING
public static $_CHARSET

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

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

# SMARTY_RESOURCE_CHAR_SET
public static $_DATE_FORMAT

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

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

# SMARTY_RESOURCE_DATE_FORMAT
public static string $_UTF8_MODIFIER

Flag denoting if PCRE should run in UTF-8 mode

Flag denoting if PCRE should run in UTF-8 mode

# 'u'
public static boolean $_IS_WINDOWS

Flag denoting if operating system is windows

Flag denoting if operating system is windows

# false
public boolean $auto_literal

auto literal on delimiters with whitspace

auto literal on delimiters with whitspace

# true
public boolean $error_unassigned

display error on not assigned variables

display error on not assigned variables

# false
public boolean $use_include_path

look up relative filepaths in include_path

look up relative filepaths in include_path

# false
private array $template_dir

template directory

template directory

# array()
public string $joined_template_dir

joined template directory string used in cache keys

joined template directory string used in cache keys

# null
public string $joined_config_dir

joined config directory string used in cache keys

joined config directory string used in cache keys

# null
public callable $default_template_handler_func

default template handler

default template handler

# null
public callable $default_config_handler_func

default config handler

default config handler

# null
public callable $default_plugin_handler_func

default plugin handler

default plugin handler

# null
private string $compile_dir

compile directory

compile directory

# null
private array $plugins_dir

plugins directory

plugins directory

# array()
private string $cache_dir

cache directory

cache directory

# null
private array $config_dir

config directory

config directory

# array()
public boolean $force_compile

force template compiling?

force template compiling?

# false
public boolean $compile_check

check template for modifications?

check template for modifications?

# true
public boolean $use_sub_dirs

use sub dirs for compiled/cached files?

use sub dirs for compiled/cached files?

# false
public boolean $allow_ambiguous_resources

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

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

# false
public boolean $caching

caching enabled

caching enabled

# false
public boolean $merge_compiled_includes

merge compiled includes

merge compiled includes

# false
public boolean $inheritance_merge_compiled_includes

template inheritance merge compiled includes

template inheritance merge compiled includes

# true
public integer $cache_lifetime

cache lifetime in seconds

cache lifetime in seconds

# 3600
public boolean $force_cache

force cache file creation

force cache file creation

# false
public string $cache_id

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

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

# null
public string $compile_id

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

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

# null
public string $left_delimiter

template left-delimiter

template left-delimiter

# "{"
public string $right_delimiter

template right-delimiter

template right-delimiter

# "}"
public string $security_class

class name This should be instance of Smarty_Security.

class name This should be instance of Smarty_Security.

See

Smarty_Security
# 'Smarty_Security'
public Smarty_Security $security_policy

implementation of security class

implementation of security class

# null
public integer $php_handling

controls handling of PHP-blocks

controls handling of PHP-blocks

# Smarty::PHP_PASSTHRU
public boolean $allow_php_templates

controls if the php template file resource is allowed

controls if the php template file resource is allowed

# false
public boolean $direct_access_security

Should compiled-templates be prevented from being called directly? }

Should compiled-templates be prevented from being called directly? }

# true
public boolean $debugging

debug mode Setting this to true enables the debug-console.

debug mode Setting this to true enables the debug-console.

# false
public string $debugging_ctrl

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.

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.
# 'NONE'
public type $smarty_debug_id

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

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

# 'SMARTY_DEBUG'
public string $debug_tpl

Path of debug template.

Path of debug template.

# null
public integer $error_reporting

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

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

# null
public boolean $get_used_tags

Internal flag for getTags()

Internal flag for getTags()

# false
public boolean $config_overwrite

Controls whether variables with the same name overwrite each other.

Controls whether variables with the same name overwrite each other.

# true
public boolean $config_booleanize

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

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

# true
public boolean $config_read_hidden

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

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

# false
public boolean $compile_locking

locking concurrent compiles

locking concurrent compiles

# true
public boolean $cache_locking

Controls whether cache resources should emply locking mechanism

Controls whether cache resources should emply locking mechanism

# false
public float $locking_timeout

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

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

# 10
public array $template_functions

global template functions

global template functions

# array()
public string $default_resource_type

resource type used if none given Must be an valid key of $registered_resources.

resource type used if none given Must be an valid key of $registered_resources.

# 'file'
public string $caching_type

caching type Must be an element of $cache_resource_types.

caching type Must be an element of $cache_resource_types.

# 'file'
public array $properties

internal config properties

internal config properties

# array()
public string $default_config_type

config type

config type

# 'file'
public array $template_objects

cached template objects

cached template objects

# array()
public boolean $cache_modified_check

check If-Modified-Since headers

check If-Modified-Since headers

# false
public array $registered_plugins

registered plugins

registered plugins

# array()
public array $plugin_search_order

plugin search order

plugin search order

# array('function', 'block', 'compiler', 'class')
public array $registered_objects

registered objects

registered objects

# array()
public array $registered_classes

registered classes

registered classes

# array()
public array $registered_filters

registered filters

registered filters

# array()
public array $registered_resources

registered resources

registered resources

# array()
public array $_resource_handlers

resource handler cache

resource handler cache

# array()
public array $registered_cache_resources

registered cache resources

registered cache resources

# array()
public array $_cacheresource_handlers

cache resource handler cache

cache resource handler cache

# array()
public array $autoload_filters

autoload filter

autoload filter

# array()
public array $default_modifiers

default modifier

default modifier

# array()
public boolean $escape_html

autoescape variable output

autoescape variable output

# false
public static array $_smarty_vars

global internal smarty vars

global internal smarty vars

# array()
public integer $start_time

start time for execution time calculation

start time for execution time calculation

# 0
public integer $_file_perms

default file permissions

default file permissions

# 0644
public integer $_dir_perms

default dir permissions

default dir permissions

# 0771
public array $_tag_stack

block tag hierarchy

block tag hierarchy

# array()
public Smarty $smarty

self pointer to Smarty object

self pointer to Smarty object

#
public string $_current_file

required by the compiler for BC

required by the compiler for BC

# null
public boolean $_parserdebug

internal flag to enable parser debugging

internal flag to enable parser debugging

# false
public array $merged_templates_func

Saved parameter of merged templates during compilation

Saved parameter of merged templates during compilation

# array()
public static array $_is_file_cache

Cache of is_file results of loadPlugin()

Cache of is_file results of loadPlugin()

# array()
Properties inherited from Smarty_Internal_Data
$config_vars, $parent, $template_class, $tpl_vars
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen