-
preface
...se goals: clean separation of presentation from application code PHP backend, Sm...
...-execution point of view, many would argue that the PHP syntax is messy and comp...
...these goals: clean separation of presentation from application code PHP backend,...
... Next Smarty 3 Manual Home  Part I. Getting Started ...
...deployment for programmers and designers quick and easy to maintain syntax easy ...
-
variable.cache.locking
...king Cache locking avoids concurrent cache generation. This means resource inten...
... Next $cache_lifetime Home  $cache_modified_check ...
-
api.create.template
...e_id variable once instead of passing this to each call to this function. It is ...
...only variables assigned to any of the objects in the parent chain. data is an op...
...a template object Description Smarty_Internal_Template createTemplate ( stri...
... Next createData() Home  disableSecurity() ...
...lid template resource type and path. cache_id is an optional parameter. You can ...
-
what.is.smarty
...tes and uses a combination of HTML tags and template tags to format the presenta...
...e way to separate application logic and content from its presentation. This is b...
...I. Getting Started Home  Chapter 2. Installation ...
...separate application logic and content from its presentation. This is best descr...
-
tips.obfuscating.email
...xample 21.8. Example of template the Obfuscating an email address div id="...
... email address gets on so many spam mailing lists? One way spammers collect emai...
...ail Addresses Do you ever wonder how your email address gets on so many spam mai...
...omponentized Templates Home  Chapter 22. Resources ...
...ource, yet it it will look and work correctly in the browser. This is done with ...
-
language.function.insert
...functions instead. Note As of Smarty 3.1 the {insert} tags are only available fr...
...ge. The banner can contain any mixture of HTML, images, flash, etc. so we can't ...
...er 7. Built-in Functions  Next {insert} IMPORTANT NOTICE {insert} tags...
... Next {include_php} Home  {ldelim},{rdelim} ...
...re deprecated from Smarty, and should not be used. Put your PHP logic in PHP scr...
-
language.modifier.default
...instead. Default takes the one argument. Parameter Position Type Required Defaul...
...  Next date_format Home  escape ...
...also the default variable handling and the blank variable handling pages. Prev ...
-
language.function.html.select.time
... It can display any or all of hour, minute, second and meridian. The time attrib...
...ns for you. It can display any or all of hour, minute, second and meridian. The ...
...pter 8. Custom Functions  Next {html_select_time} {html_select_time} i...
...ext {html_select_date} Home  {html_table} ...
...ll of hour, minute, second and meridian. The time attribute can have different f...
-
language.modifiers
... Variable Modifiers Table of Contents capitalize cat count_characters count_par...
...odifiers can be applied to any type of variables, including arrays and objects. ...
...riable Modifiers Table of Contents capitalize cat count_characters count_paragra...
...rty} reserved variable Home  cat ...
...lue followed by a | (pipe) and the modifier name. A modifier may accept addition...
-
advanced.features.streams
...t Template Inheritance Home  Objects ...
-
installing.smarty.basic
...n the /libs/ sub directory of the distribution. These are .php files that you SH...
...e the same environment for any application, just replace guestbook/ with the nam...
... Basic Installation Basic Installation basic, installation Basic Installation Pr...
... 2. Installation Home  Extended Setup ...
...red among all applications and only get changed when you upgrade to a new versio...
-
tips.dates
... Â Next Dates As a rule of thumb, always pass dates to Smarty as timestamps ....
..._format modifier for full control over date formatting, and also makes it easy t...
...tle to header template Home  WAP/WML ...
...trol over date formatting, and also makes it easy to compare dates if necessary....
-
charset
... Charset Encoding Table of Contents Charset Encoding Charset Encoding There a...
...Charset Encoding Table of Contents Charset Encoding Charset Encoding There are a...
...Smarty For Programmers Home  Chapter 12. Constants ...
... data, ISO-8859-1 (Latin1) and UTF-8 being the most popular. Unless specified ot...
-
variable.smarty.debug.id
...$smarty_debug_id The value of $smarty_debug_id defines the URL keyword to enable...
...marty_debug_id defines the URL keyword to enable debugging at browser level. The...
...EBUG . See also debugging console section, $debugging and $debugging_ctrl . Prev...
... Next $right_delimiter Home  $template_dir ...
...onsole section, $debugging and $debugging_ctrl . Prev  Up  Next $right_d...
-
variable.cache.lifetime
...ifetime This is the length of time in seconds that a template cache is valid. On...
...or $cache_lifetime to have any purpose. A $cache_lifetime value of -1 will force...
...s the length of time in seconds that a template cache is valid. Once this time h...
...Up  Next $cache_id Home  $cache_locking ...
-
plugins.outputfilters
... parameter is the instance of Smarty invoking the plugin. The plugin is supposed...
...put filter plugins operate on a template's output, after the template is loaded ...
...Prefilters/Postfilters Home  Resources ...
...ter the template is loaded and executed, but before the output is displayed. str...
-
api.get.tags
... function returns an array of tagname/attribute pairs for all tags used by the t...
... used by template Description string getTags ( object template ); This f...
... getRegisteredObject() Home  getTemplateDir() ...
-
api.unregister.plugin
...ers: type defines the type of the plugin. Valid values are "function", "block", ...
...nregister plugins Description void unregisterPlugin ( string type ,  ...
...ext unregisterFilter() Home  unregisterObject() ...
...tion", "block", "compiler" and "modifier". name defines the name of the plugin. ...
-
language.function.php
...functions instead. Note As of Smarty 3.1 the {php} tags are only available from ...
...er 7. Built-in Functions  Next {php} IMPORTANT NOTICE {php} tags are d...
...Up  Next {nocache} Home  {section},{sectionelse} ...
...re deprecated from Smarty, and should not be used. Put your PHP logic in PHP scr...
-
language.modifier.truncate
..., you can specify a string of text to display at the end if the variable was tru...
...No 80 This determines how many characters to truncate to. 2 string No ... This i...
...e default is 80. As an optional second parameter, you can specify a string of te...
...p  Next to_charset Home  unescape ...
-
variable.cache.dir
...cache_dir This is the name of the directory where template caches are stored. By...
...n custom cache implementation to control cache files, which will ignore this set...
...Next $autoload_filters Home  $cache_id ...
...irectly. Use getCacheDir() and setCacheDir() instead. See also getCacheDir() , s...
-
language.function.append
...rrays during the execution of a template . Note Assignment of variables in-templ...
...er 7. Built-in Functions  Next {append} {append} is used for creating ...
... Built-in Functions Home  {assign} ...
...tation that may be better handled in PHP. Use at your own discretion. Attributes...
-
variable.default.resource.type
...ers Home  $default_config_handler_func ...
...ext $default_modifiers Home  $default_config_handler_func ...
...arty- display('index.tpl') and $smarty- display('file:index.tpl') are identical ...
-
language.modifier.spacify
...ce between every character of a variable. You can optionally pass a different ch...
...of a variable. You can optionally pass a different character or string to insert...
... Up  Next replace Home  string_format ...
...^a^^y^^. See also wordwrap and nl2br . Prev  Up  Next replace Home ...
-
language.variables.smarty
...t variables. The full list of them follows. Request variables The request variab...
...display value of page from URL ($_GET) http://www.example.com/index.php?page=foo...
...sed to access several environment and request variables. The full list of them f...
...aded from config files Home  Chapter 5. Variable Modifiers ...
...access several environment and request variables. The full list of them follows....
-
api.template.exists
...d template exists Description bool templateExists ( string template ); I...
... Next setTemplateDir() Home  unregisterCacheResource() ...
...e='page_footer.tpl'} /body And the php script ?php // set the filename eg index....
-
language.syntax.functions
...iable or invokes some sort of function. These are processed and displayed by enc...
... Functions Functions functions Functions Prev  Chapter 3. Basic Syntax...
...Up  Next Variables Home  Attributes ...
...ction. These are processed and displayed by enclosing the function and its attri...
...Built-in functions are the inner workings of Smarty, such as {if} , {section} an...
-
language.modifier.count.sentences
...s used to count the number of sentences in a variable. A sentence being delimite...
... delimited by a dot, question- or exclamation-mark (.?!). Example 5.6. cou...
... Next count_paragraphs Home  count_words ...
...racters , count_paragraphs and count_words . Prev  Up  Next count_paragr...
-
api.test.install
...l required working folders of the Smarty installation can be accessed. It does o...
... checks Smarty installation Description void testInstall (); This function...
...t unregisterResource() Home  Chapter 15. Caching ...
-
smarty.for.designers
...r Template Designers Table of Contents 3. Basic Syntax Comments Variables Functi...
...mplate Designers Table of Contents 3. Basic Syntax Comments Variables Functions ...
... Next Extended Setup Home  Chapter 3. Basic Syntax ...
-
language.function.strip
... returns affect the output of the rendered HTML (browser "features"), so you mus...
...nctions  Next {strip} Many times web designers run into the issue where whit...
...border='0' tr td a href="{$url}" font color="red" This is a test /font /a /td /t...
...er 7. Built-in Functions  Next {strip} Many times web designers run in...
...  Next {setfilter} Home  {while} ...
...he issue where white space and carriage returns affect the output of the rendere...
-
language.syntax.variables
...-- display the 5th element of a zero-indexed array {$foo.bar} -- display the "ba...
...plays "baa", see {assign} Many other combinations are allowed {$foo.bar.baz} {$f...
...he $dollar sign. They can contain numbers, letters and underscores, much like a ...
... 3. Basic Syntax Home  Functions ...
...n contain numbers, letters and underscores, much like a PHP variable . You can r...
-
api.assign.by.ref
...Note With the introduction of PHP5, assignByRef() is not necessary for most inte...
...lues by reference Description void assignByRef ( string varname ,  Â...
... Up  Next assign() Home  clearAllAssign() ...
...necessary for most intents and purposes. assignByRef() is useful if you want a P...
-
language.function.html.select.date
... It can display any or all of year, month, and day. All parameters that are not ...
... dropdowns. It can display any or all of year, month, and day. All parameters th...
...pter 8. Custom Functions  Next {html_select_date} {html_select_date} i...
... Next {html_radios} Home  {html_select_time} ...
...any or all of year, month, and day. All parameters that are not in the list belo...
-
language.variable.scopes
...ign variables to the scope of the main Smarty object, data objects created with ...
...ate objects you have full control which variables can be seen by a template. Exa...
...ter 4. Variables Home  Variables loaded from config files ...
...reated with createData() , and template objects created with createTemplate() . ...
-
variable.escape.html
...his feature by adding the nofilter flag: {$variable nofilter} . Modifiers and Fi...
...This is a compile time option. If you change the setting you must make sure that...
... Next $error_reporting Home  $force_cache ...
...able nofilter} . Modifiers and Filters are run in the following order: modifier,...
-
language.escaping
...s will also take advantage of browser script caching. When you need to embed Sma...
...to have Smarty ignore sections it would otherwise parse. A classic example is em...
... Up  Next Math Home  Chapter 4. Variables ...
... those languages use the { and } characters which are also the default delimiter...
-
variable.trusted.dir
... enabled. This is an array of all directories that are considered trusted. Trust...
...rusted_dir $trusted_dir is only for use when security is enabled. This is an arr...
... Next $template_dir Home  $use_include_path ...
-
variable.plugins.dir
...f $plugins_dir is an array of directories, Smarty will search for your plugin in...
...ribute $plugins_dir is no longer accessible directly. Use getPluginsDir() , setP...
... Next $php_handling Home  $right_delimiter ...
...insDir() , setPluginsDir() and addPluginsDir() instead. See also getPluginsDir()...
-
language.function.nocache
...is used to disable caching of a template section. Every {nocache} must be paired...
... {/nocache} . Note Be sure any variables used within a non-cached section are al...
...er 7. Built-in Functions  Next {nocache} {nocache} is used to disable ...
...Up  Next {literal} Home  {php} ...
-
variable.config.read.hidden
... $config_read_hidden $config_read_hidden , config_read_hidden $config_read_hidde...
...Next $config_overwrite Home  $debug_tpl ...
...uch as database parameters and not worry about the template loading them. FALSE ...
-
api.append.by.ref
...Note With the introduction of PHP5, appendByRef() is not necessary for most inte...
...lues by reference Description void appendByRef ( string varname ,  Â...
... Up  Next append() Home  assign() ...
...necessary for most intents and purposes. appendByRef() is useful if you want a P...
-
variable.use.sub.dirs
...there are potentially tens of thousands of files created, this may help the file...
...ault is FALSE . In an environment where there are potentially tens of thousands ...
...Next $use_include_path Home  Chapter 14. Smarty Class Methods ...
...der the compiled templates and cache directories if $use_sub_dirs is set to TRUE...
-
language.modifier.regex.replace
...tion code and are not part of presentation logic. Parameters Parameter Position ...
..._replace A regular expression search and replace on a variable. Use the preg_rep...
... Up  Next nl2br Home  replace ...
... regular expression search and replace on a variable. Use the preg_replace() syn...
-
variable.config.dir
...ver document root. Note As of Smarty 3.1 the attribute $config_dir is no longer ...
... $config_dir $config_dir , config_dir $config_dir Prev  Chapter 13. Sm...
...ext $config_booleanize Home  $config_overwrite ...
...nfigDir() , setConfigDir() and addConfigDir() instead. See also getConfigDir() ,...
-
variable.compile.id
..._id and you will get a set of compiled templates for each language you use. Anot...
...id to each and every function call, you can set this $compile_id and it will be ...
... Next $compile_dir Home  $compile_locking ...
...e same $compile_id to each and every function call, you can set this $compile_id...
-
caching
...er 15. Caching Table of Contents Setting Up Caching Multiple Caches Per Pa...
...ecked for modification. If any of the files have been modified since the cache w...
... 15. Caching Table of Contents Setting Up Caching Multiple Caches Per Page C...
...set the cache_lifetime for home.tpl to 1 hour $smarty- setCacheLifetime(3600); $...
...reful what you are caching and for how long. For instance, if you are displaying...
-
language.modifier.replace
...Yes n/a This is the string of text to be replaced. 2 string Yes n/a This is the ...
... simple search and replace on a variable. This is equivalent to the PHP's str_re...
... Next regex_replace Home  spacify ...
...xt replace A simple search and replace on a variable. This is equivalent to the ...
-
variable.default.modifiers
...modifiers This is an array of modifiers to implicitly apply to every variable in...
... Up  Next $default_config_type Home  $default_resource_type ...
...t $default_config_type Home  $default_resource_type ...
-
language.syntax.quotes
... syntax, it is a good rule of thumb to keep the template syntax minimal and focu...
...ming for more detail. With any other characters, for example a period(.) or $obj...
...ded in "double quotes" so long as the variable name contains only numbers, lette...
...p  Next Attributes Home  Math ...
...ains only numbers, letters and under_scores. See naming for more detail. With an...
-
advanced.features.template.inheritance
...ritance brings the concept of Object Oriented Programming to templates, allowing...
...d templates can not define any content besides what's inside {block} tags they o...
...ce Inheritance brings the concept of Object Oriented Programming to templates, a...
...g settings by template Home  Streams ...
...e that extends another one and so on. The child templates can not define any con...
-
variable.compiler.class
...r_class Specifies the name of the compiler class that Smarty will use to compile...
...piler'. For advanced users only. Prev  Up  Next $compile_locking Hom...
... Next $compile_locking Home  $config_booleanize ...
-
api.set.template.dir
...emplateDir()); // chaining of method calls $smarty- setTemplateDir('./templates'...
...plates are stored Description Smarty setTemplateDir ( string|array templ...
... Next setPluginsDir() Home  templateExists() ...
...teDir() , addTemplateDir() and $template_dir . Prev  Up  Next setPlugins...
-
variable.debugging.ctrl
...nabled for that invocation of the script. If $debugging is TRUE , this value is ...
...rnate methods are allowed. URL means when the keyword SMARTY_DEBUG is found in t...
...ways to enable debugging. NONE means no alternate methods are allowed. URL means...
...p  Next $debugging Home  $default_config_type ...
...onsole section, $debugging and $smarty_debug_id . Prev  Up  Next $debugg...
-
language.custom.functions
... Custom Functions Table of Contents {counter} {cycle} {eval} {fetch} {html_ch...
...pter 8. Custom Functions Chapter 8. Custom Functions chapter, 8, cus...
... Up  Next {while} Home  {cycle} ...
...t the number, the interval and the direction of the count, as well as determine ...
-
language.function.mailto
...to} automates the creation of a mailto: anchor links and optionally encodes them...
...comma. extra string No n/a Any extra information you want passed to the link, su...
...pter 8. Custom Functions  Next {mailto} {mailto} automates the creatio...
... Next {html_table} Home  {math} ...
... of a mailto: anchor links and optionally encodes them. Encoding emails makes it...
-
language.syntax.attributes
... Â Next Attributes Most of the functions take attributes that specify or modi...
...ple.com"} select name="company_id" {html_options options=$companies selected=$co...
...tributes Most of the functions take attributes that specify or modify their beha...
...Up  Next Functions Home  Embedding Vars in Double Quotes ...
...odifiers may also be used, and should not be in quotes. You can even use PHP fun...
-
language.modifier.to_charset
...This is the exact opposite of the from_charset modifier . Parameter Position Typ...
...o ISO-8859-1 , UTF-8 , and any character set supported by mb_convert_encoding() ...
...modifier . Parameter Position Type Required Possible Values Default Description ...
...p  Next strip_tags Home  truncate ...
...ng No ISO-8859-1 , UTF-8 , and any character set supported by mb_convert_encodin...
-
inforesources
...glegroups.com . An archive of the mailing list can be viewed at here Forums are ...
... e-mail to ismarty-discussion-subscribe@googlegroups.com . An archive of the mai...
...22. Resources Smarty's homepage is located at http://www.smarty.net/ You can...
....net#smarty FAQ's are here and here Prev  Up  Next Obfuscating E-mail Ad...
-
api.register.default.plugin.handler
...the function name An array of the form array( $object, $method) with $object bei...
... — register a function which gets called on undefined tags Description vo...
... Next registerClass() Home  registerFilter() ...
... registerDefaultPluginHandler() registerDefaultPluginHandler() registerdefaultpl...
-
language.modifier.lower
...the PHP strtolower() function. Example 5.13. lower ?php $smarty- assign('a...
... Up  Next indent Home  nl2br ...
... jury hung. See also upper and capitalize . Prev  Up  Next indent Ho...
-
language.function.config.load
...le string Yes n/a The name of the config file to include section string No n/a T...
... {config_load} {config_load} , ldelim, config_load, rdelim, {config_load} Prev ...
...Up  Next {capture} Home  {debug} ...
...nto both the local context and the parent template that called it. global means ...
-
language.function.textformat
...ent number No 0 The number of chars to indent every line indent_first number No ...
...ith wrap number No 80 How many characters to wrap each line to wrap_char string ...
...pter 8. Custom Functions  Next {textformat} {textformat} is a block fu...
... Up  Next {math} Home  Chapter 9. Config Files ...
...basically cleans up spaces and special characters, and formats paragraphs by wra...
-
language.function.eval
...sign attribute, the output of the {eval} function will be assigned to this templ...
...g title = Welcome to {$company}'s home page! ErrorCity = You must supply a {#emp...
...pter 8. Custom Functions  Next {eval} {eval} is used to evaluate a var...
... = Welcome to {$company}'s home page! ErrorCity = You must supply a {#emphstart#...
...follow the same escapement and security features just as if they were templates....
-
api.is.cached
... if $caching is set to one of Smarty::CACHING_LIFETIME_CURRENT or Smarty::CACHIN...
... and stores it internally. Any subsequent call to display() or fetch() will retu...
...for this template Description bool isCached ( string template ,   ...
...Next getTemplateVars() Home  loadFilter() ...
...ly loads the cached output and stores it internally. Any subsequent call to disp...
-
getting.started
.... Getting Started Table of Contents 1. What is Smarty? 2. Installation Requir...
...Getting Started Table of Contents 1. What is Smarty? 2. Installation Requiremen...
...  Next Preface Home  Chapter 1. What is Smarty? ...
-
language.function.for
...simple loop with step size of 1. {for $var=$start to $end step $step} loop with ...
...er 7. Built-in Functions  Next {for} The {for}{forelse} tag is used to...
...Up  Next {extends} Home  {foreach},{foreachelse} ...
...utes: Attribute Name Shorthand Type Required Default Description max n/a integer...
-
variable.template.dir
...plate_dir This is the name of the default template directory. If you do not supp...
...e the directories and stop on the first matching template found. Technical Note ...
... Next $smarty_debug_id Home  $trusted_dir ...
...l traverse the directories and stop on the first matching template found. Techni...
-
language.basic.syntax
... 3. Basic Syntax Table of Contents Comments Variables Functions Attributes E...
...ant *} {* select name="company" {html_options options=$vals selected=$selected_i...
... Basic Syntax Table of Contents Comments Variables Functions Attributes Embed...
...For Template Designers Home  Variables ...
...rs. By default these are { and } , but they can be changed . For the examples in...
-
language.builtin.functions
... Built-in Functions Table of Contents {$var=...} {append} {assign} {block} {cal...
...er 7. Built-in Functions Chapter 7. Built-in Functions chapter, 7, b...
... Combining Modifiers Home  {append} ...
...ctions with the same name; and you should not need to modify the built-in functi...
-
smarty.constants
... 12. Constants Table of Contents SMARTY_DIR SMARTY_DIR This is the full sy...
... Chapter 12. Constants Chapter 12. Constants chapter, 12, constants ...
...1. Charset Encoding Home  Chapter 13. Smarty Class Variables ...
...; ? See also $smarty.const and $php_handling constants Prev  Up  Next Ch...
-
advanced.features
... Advanced Features Table of Contents Security Changing settings by template Te...
...dvanced Features Table of Contents Security Changing settings by template Templa...
...tom Template Resources Home  Changing settings by template ...
... the templates eg via ftp, and you want to reduce the risk of system security co...
-
language.function.html.table
...nction that dumps an array of data into an HTML table . Attribute Name Type Requ...
...cells on last row with (if any) hdir string No right Direction of each row to be...
...pter 8. Custom Functions  Next {html_table} {html_table} is a custom f...
...ext {html_select_time} Home  {mailto} ...
...uted by the number of rows and the number of elements to display to be just enou...
...s to display all elements. inner string No cols Direction of consecutive element...
-
resources.string
...ecessary for the usual use of string: and eval: , but is required when using eit...
...ources may be encoded with urlencode() or base64_encode() . This is not necessar...
...n using either of them in conjunction with Extends Template Resource Example ...
...er 16. Resources Home  Stream Template Resources ...
... is compiled from a string and stores the compiled template code for later reuse...
-
plugins
... Smarty With Plugins Table of Contents How Plugins Work Naming Conventions Writi...
...rty With Plugins Table of Contents How Plugins Work Naming Conventions Writing P...
... Next Output Filters Home  Naming Conventions ...
...he old way of registering handler functions via register_* API is preserved. If ...
-
advanced.features.template.settings
... by template Normally you configure the Smarty settings by modifying the Smarty ...
.... Advanced Features Home  Template Inheritance ...
...the Smarty class variables and functions can be accessed or called by induvidual...
-
bugs
...th the latest distribution of Smarty, or check the website. Prev  Up  Ch...
... with the latest distribution of Smarty, or check the website. Prev  Up  ...
...er 22. Resources Home  ...
-
language.function.foreach
...ed for looping over arrays of data. {foreach} has a simpler and cleaner syntax t...
...ach syntax does not accept any named attributes. This syntax is new to Smarty 3,...
...er 7. Built-in Functions  Next {foreach},{foreachelse} {foreach} is us...
... Up  Next {for} Home  {function} ...
...a. {foreach} has a simpler and cleaner syntax than the {section} loop, and can a...
-
plugins.prefilters.postfilters
...-- more precisely the time of their execution. string smarty_prefilter_name ( $s...
...t this source is not saved anywhere, it is only used for compilation. string sma...
...ugins are very similar in concept; where they differ is in the execution -- more...
...ext Compiler Functions Home  Output Filters ...
...ters/Postfilters Prefilter and postfilter plugins are very similar in concept; w...
-
caching.custom
...ng to achieve at least one of the following goals: replace the slow filesystem b...
...ore API allows you to turn any "dumb" KeyValue-Store (like APC, Memcache, â€...
... Custom Cache Implementation Custom Cache Implementation custom, cache, implemen...
...Cacheability of Output Home  Chapter 16. Resources ...
...ill be used to read, write and clear cached files. Note In Smarty2 this used to ...
-
tips
... 21. Tips Tricks Table of Contents Blank Variable Handling Default Variable ...
...ackgrounds work properly. Many would use an {if} statement to handle this, but t...
.... Tips Tricks Table of Contents Blank Variable Handling Default Variable Hand...
...20. Troubleshooting Home  Default Variable Handling ...
...f Contents Blank Variable Handling Default Variable Handling Passing variable ti...
-
language.function.html.checkboxes
...ovided data. It takes care of which item(s) are selected by default as well. Att...
...pter 8. Custom Functions  Next {html_checkboxes} {html_checkboxes} is ...
... Up  Next {fetch} Home  {html_image} ...
...y Yes, unless using values and output n/a An associative array of values and out...
-
chapter.debugging.console
...y. The console informs you of all the included templates, assigned variables and...
...utting SMARTY_DEBUG in the URL if you enable this option with $debugging_ctrl . ...
...apter 10. Debugging Console Chapter 10. Debugging Console chapter, 1...
... 9. Config Files Home  Part III. Smarty For Programmers ...
...plates, assigned variables and config file variables for the current invocation ...
-
api.get.config.vars
...rameter is given, an array of all loaded config variables is returned. ExampleÂ...
... getConfigVars() getConfigVars() getconfigvars, getConfigVars() Prev  Chapte...
... Next getConfigDir() Home  getPluginsDir() ...
...onfig_load} , configLoad() and getTemplateVars() . Prev  Up  Next getCon...
-
language.function.extends
...s. For details see section of Template Interitance . The {extends} tag must be o...
...contain only {block} tags. Any other template content is ignored. Use the syntax...
...er 7. Built-in Functions  Next {extends} {extends} tags are used in ch...
... Up  Next {debug} Home  {for} ...
...ds 'parent.tpl'} {* short-hand *} See also Template Interitance and {block} . Pr...
-
api.unregister.filter
...ers: type defines the type of the filter. Valid values are "pre", "post", "outpu...
...register a filter Description void unregisterFilter ( string type ,  ...
...egisterCacheResource() Home  unregisterPlugin ...
...re "pre", "post", "output" and "variable". callback defines the PHP callback. it...
-
variable.config.booleanize
...TRUE , config files values of on/true/yes and off/false/no get converted to bool...
... $config_booleanize $config_booleanize , config_booleanize $config_booleanize Pr...
... Next $compiler_class Home  $config_dir ...
...iles values of on/true/yes and off/false/no get converted to boolean values auto...
-
api.config.load
...unction. Technical Note As of Smarty 2.4.0, assigned template variables are kept...
... configLoad() configLoad() configload, configLoad() Prev  Chapter 14. ...
... compileAllTemplates() Home  createData() ...
...” loads config file data and assigns it to the template Description void c...
-
troubleshooting
.... Troubleshooting Table of Contents Smarty/PHP errors Smarty/PHP errors Smart...
...P errors Smarty can catch many errors such as missing tag attributes or malforme...
...Troubleshooting Table of Contents Smarty/PHP errors Smarty/PHP errors Smarty ca...
...t IV. Appendixes Home  Chapter 21. Tips Tricks ...
...late name, the line number and the error. After that, the error consists of the ...
-
language.function.html.image
... Alternative description of the image href string no n/a href value to link th...
...pter 8. Custom Functions  Next {html_image} {html_image} is a custom f...
...Next {html_checkboxes} Home  {html_options} ...
...n HTML img tag. The height and width are automatically calculated from the image...
-
api.functions
...Smarty Class Methods Table of Contents addConfigDir() — add a directory t...
...ty Class Methods Table of Contents addConfigDir() — add a directory to th...
... Next $use_sub_dirs Home  addConfigDir() ...
...” loads config file data and assigns it to the template createData() — ...
-
plugins.block.functions
...ck functions are functions of the form: {func} .. {/func} . In other words, they...
...ity for it to control how many times the block is displayed. By default $repeat ...
... Block Functions Block Functions block, functions Block Functions Prev  Chap...
...Up  Next Modifiers Home  Compiler Functions ...
...y enclose a template block and operate on the contents of this block. Block func...
-
variable.php.handling
...couraged. Use custom functions or modifiers instead. Prev  Up  Next $mer...
...erge_compiled_includes Home  $plugins_dir ...
... $php_handling $php_handling , php_handling $php_handling Prev  Chapter 1...
-
language.combining.modifiers
...s You can apply any number of modifiers to a variable. They will be applied in t...
...ng Modifiers You can apply any number of modifiers to a variable. They will be a...
...er 7. Built-in Functions ...
... Up  Next wordwrap Home  Chapter 7. Built-in Functions ...
-
tips.default.var.handling
... this somewhere at the top of your template *} {assign var='title' value=$title|...
...fier every time it is mentioned can get a bit ugly. You can remedy this by assig...
... 21. Tips Tricks Home  Passing variable title to header template ...
... Default Variable Handling Default Variable Handling default, variable, handling...
-
variable.locking.timeout
...This is maximum time in seconds a cache lock is valid to avoid dead locks. The d...
... Next $left_delimiter Home  $merge_compiled_includes ...
-
plugins.writing
...istered at runtime via one of the register_* API functions. They can also be unr...
... registered at runtime via one of the register_* API functions. They can also be...
...ext Naming Conventions Home  Template Functions ...
-
language.math
... syntax, it is a good rule of thumb to keep the template syntax minimal and focu...
... some very complex expressions and syntax, it is a good rule of thumb to keep th...
... Vars in Double Quotes Home  Escaping Smarty Parsing ...
... Note Although Smarty can handle some very complex expressions and syntax, it is...
-
tips.passing.vars
...template When the majority of your templates use the same headers and footers, i...
...ers and footers, it is common to split those out into their own templates and {i...
...ault Variable Handling Home  Dates ...
...lates use the same headers and footers, it is common to split those out into the...
-
variable.caching.type
...roperty specifies the name of the caching handler to use. It defaults to file , ...
...e Custom Cache Implementation for pointers on setting up your own cache handler....
... Up  Next $caching Home  $compile_check ...
...s the name of the caching handler to use. It defaults to file , enabling the int...
-
variable.cache.modified.check
...eader will be sent instead of the content. This works only on cached content wit...
...ll be sent instead of the content. This works only on cached content without {in...
... Next $cache_locking Home  $caching ...
...aching , $cache_lifetime , and the caching section . Prev  Up  Next $cac...
-
api.get.template.vars
...rameter is given, an array of all assigned variables are returned. Example 14...
...variable value(s) Description array getTemplateVars ( string varname ); ...
... Next getTemplateDir() Home  isCached() ...
...ssign() , clearAllAssign() and getConfigVars() Prev  Up  Next getTemplat...
-
advanced.features.static.classes
...the Best Practices section of the Smarty website. Example 17.10. static cl...
...es the underlying application code structure directly to the presentation, and a...
... Up  Next Objects Home  Prefilters ...
...ectly to the presentation, and also complicates template syntax. It is recommend...
-
api.unregister.object
...egister an object Description void unregisterObject ( string object_name...
... Next unregisterPlugin Home  unregisterResource() ...
... See also registerObject() and objects section Prev  Up  Next unregister...
-
variable.caching
...or not to cache the output of the templates to the $cache_dir . By default this ...
...ent will be regenerated if any of the templates or config files that are part of...
...efault this is set to the constant Smarty::CACHING_OFF. If your templates consis...
... $cache_modified_check Home  $caching_type ...
...dified_check , is_cached() and the caching section . Prev  Up  Next $cac...
-
advanced.features.outputfilters
...ction to return the result of the processing. Example 17.13. Using a templ...
...splay("index.tpl'); // now any occurrence of an email address in the template ou...
...output can be sent through one or more output filters. This differs from postfil...
...  Next Postfilters Home  Chapter 18. Extending Smarty With Plug...
...put as the first argument, and expect the function to return the result of the p...
-
plugins.inserts
...on is an associative array of attributes passed to the insert. The insert functi...
...re used to implement functions that are invoked by {insert} tags in the template...
...Up  Next Resources Home  Chapter 19. SmartyBC - Backwards Compa...
-
smarty.for.programmers
...arty For Programmers Table of Contents 11. Charset Encoding Charset Encoding 12....
...emplate_dir Templates from any directory Windows Filepaths String Template Resou...
... For Programmers Table of Contents 11. Charset Encoding Charset Encoding 12. Con...
.... Debugging Console Home  Chapter 11. Charset Encoding ...
...urce_type $default_config_handler_func $default_template_handler_func $direct_ac...
-
language.modifier.upper
...the PHP strtoupper() function. Example 5.23. upper ?php $smarty- assign('a...
... Up  Next unescape Home  wordwrap ...
...ST A WHILE. See also lower and capitalize . Prev  Up  Next unescape ...
-
variable.right.delimiter
... Next $plugins_dir Home  $smarty_debug_id ...
.... See also $left_delimiter and escaping smarty parsing . Prev  Up  Next ...
-
plugins.resources
...are meant as a generic way of providing template sources or PHP script component...
... sources or PHP script components to Smarty. Some examples of resources: databas...
... Next Output Filters Home  Inserts ...
...P, shared memory, sockets, and so on. Custom Resources may be put in a file reso...
-
appendixes
... IV. Appendixes Table of Contents 20. Troubleshooting Smarty/PHP errors 21....
...V. Appendixes Table of Contents 20. Troubleshooting Smarty/PHP errors 21. Tip...
... Compatibility Wrapper Home  Chapter 20. Troubleshooting ...
...ips Tricks Blank Variable Handling Default Variable Handling Passing variable ti...
-
language.modifier.wordwrap
..., you can specify a string of text to wrap the text to the next line, the defaul...
...No 80 This determines how many columns to wrap to. 2 string No \n This is the st...
...e default is 80. As an optional second parameter, you can specify a string of te...
... Up  Next upper Home  Chapter 6. Combining Modifiers ...
...n in years. See also nl2br and {textformat} . Prev  Up  Next upper H...
-
variable.debug_template
...debug_tpl This is the name of the template file used for the debugging console. ...
...le used for the debugging console. By default, it is named debug.tpl and is loca...
...xt $config_read_hidden Home  $debugging ...
...ult, it is named debug.tpl and is located in the SMARTY_DIR . See also $debuggin...
-
language.function.block
...sed to define a named area of template source for template inheritance. For deta...
...emplate can be inserted at any location of the child {block} content. {$smarty.b...
...er 7. Built-in Functions  Next {block} {block} is used to define a nam...
... Up  Next {assign} Home  {call} ...
...lly {block} areas of child and parent templates can be merged into each other. Y...
-
api.clear.assign
... — clears the value of an assigned variable Description void clearAss...
...assigned variable Description void clearAssign ( mixed var ); This can b...
... Next clearAllCache() Home  clearCache() ...
...tTemplateVars() , assign() and append() Prev  Up  Next clearAllCache()Â...
-
language.modifier.strip
...f you want to strip blocks of template text, use the built-in {strip} function. ...
...the built-in {strip} function. Example 5.19. strip ?php $smarty- assign('a...
... Next string_format Home  strip_tags ...
... repeated spaces, newlines and tabs with a single space, or with the supplied st...
-
variable.autoload.filters
...ypes and values are arrays of the filter names. For example: ?php $smarty- autol...
...ters that you wish to load on every template invocation, you can specify them us...
... Next $auto_literal Home  $cache_dir ...
...y them using this variable and Smarty will automatically load them for you. The ...
-
api.get.template.dir
...plates are stored Description string|array getTemplateDir ( string key )...
...Up  Next getTags() Home  getTemplateVars() ...
...teDir() , addTemplateDir() and $template_dir . Prev  Up  Next getTags()...
-
caching.cacheable
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
...hing. General Note Be sure any variables used within a non-cached section are al...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
... Next Cache Groups Home  Custom Cache Implementation ...
...ing by using the {nocache} and {/nocache} tags. Example 15.10. Preventing ...
-
bc
...ompatibility Wrapper Table of Contents SmartyBC class SmartyBC class TODO: Smart...
...tibility Wrapper Table of Contents SmartyBC class SmartyBC class TODO: SmartyBC ...
... Up  Next Inserts Home  Part IV. Appendixes ...
...DO: SmartyBC allows: {php} and {include_php} Example 19.1. Using SmartyBC ...
-
caching.groups
...as you like. You can think of cache groups like a directory hierarchy. For insta...
...id value. You can have as many sub-groups as you like. You can think of cache gr...
...ouping works left-to-right ONLY. You will need to group your templates under a s...
...ltiple Caches Per Page Home  Controlling Cacheability of Output ...
...like themes/blue/index.tpl and you want to be able to clear all the cache files ...
-
api.assign
...al third nocache parameter of TRUE , the variable is assigned as nocache variabl...
... to the templates Description void assign ( mixed var ); void assign...
... Next appendByRef() Home  assignByRef() ...
...e sure that all properties and methods accessed from the template are for presen...
-
language.function.if
...om $php_functions property of the securty policy are allowed. See the Security s...
...er 7. Built-in Functions  Next {if},{elseif},{else} {if} statements in...
...p  Next {function} Home  {include} ...
... a matching {/if} . {else} and {elseif} are also permitted. All PHP conditionals...
-
variable.compile.dir
...mpile_dir This is the name of the directory where compiled templates are located...
...ribute $compile_dir is no longer accessible directly. Use getCompileDir() and se...
... Next $compile_check Home  $compile_id ...
...ectly. Use getCompileDir() and setCompileDir() instead. See also getCompileDir()...
-
api.add.plugins.dir
...dd a directory to the list of directories where plugins are stored Description S...
...lugins are stored Description Smarty addPluginsDir ( string|array plugin...
... Next addConfigDir() Home  addTemplateDir() ...
...insDir() , setPluginsDir() and $plugins_dir . Prev  Up  Next addConfigDi...
-
language.variables
...r 4. Variables Table of Contents Variables assigned from PHP Associative a...
...4. Variables Table of Contents Variables assigned from PHP Associative array...
...ple.com', 'phone' = array('home' = '555-444-3333', 'cell' = '555-111-1234') ) );...
...for functions , attributes and modifiers , inside conditional expressions, etc. ...
-
advanced.features.postfilters
...ction to return the result of the processing. Example 17.12. Using a templ...
... postfilters are PHP functions that your templates are ran through after they ar...
...p  Next Prefilters Home  Output Filters ...
...ode as the first argument, and expect the function to return the result of the p...
-
api.set.cache.dir
...ir('./cache'); // chaining of method calls $smarty- setTemplateDir('./templates'...
... output is stored Description Smarty setCacheDir ( string cache_dir ); E...
...ext registerResource() Home  setCompileDir() ...
...; ? See also getCacheDir() and $cache_dir . Prev  Up  Next registerResou...
-
language.function.setfilter
... tag allows the definition of template instance's variable filters. SYNTAX: {set...
...er 7. Built-in Functions  Next {setfilter} The {setfilter}...{/setfilt...
...section},{sectionelse} Home  {strip} ...
...ier specified by it's name and optional additional parameter. {setfilter}...{/se...
.... The filter definition of inner blocks does replace the definition of the outer...
-
language.modifier.unescape
... . It counters the effects of the escape modifier for the given types. Parameter...
...o ISO-8859-1 , UTF-8 , and any character set supported by htmlentities() UTF-8 T...
...ven types. Parameter Position Type Required Possible Values Default Description ...
... Up  Next truncate Home  upper ...
...ed to decode entity , html and htmlall . It counters the effects of the escape m...
-
plugins.naming.conventions
...ame .php Where type is one of these plugin types: function modifier block compil...
... Naming Conventions Naming Conventions naming, conventions Naming Conventions Pr...
...ng Smarty With Plugins Home  Writing Plugins ...
...g Conventions Plugin files and functions must follow a very specific naming conv...
-
language.modifier.escape
...o ISO-8859-1 , UTF-8 , and any character set supported by htmlentities() UTF-8 T...
...scape a variable to html , url , single quotes , hex , hexentity , javascript an...
...its html . Parameter Position Type Required Possible Values Default Description ...
... Up  Next default Home  from_charset ...
...x , hexentity , javascript and mail . By default its html . Parameter Position T...
-
api.fetch
...he template output instead of displaying it. Supply a valid template resource ty...
...e cache_id for each unique URL $cache_id = md5($_SERVER['REQUEST_URI']); // capt...
...e template output Description string fetch ( string template ,   ...
... Next enableSecurity() Home  getCacheDir() ...
...lid template resource type and path. As an optional second parameter, you can pa...
-
resources.extends
...t. For details see section of Template Interitance . As of Smarty 3.1 the extend...
... extends: resource may use any available template resource , including string: a...
...ke sure they are properly (url or base64) encoded. Is an eval: resource found wi...
... define child/parent relationships for template inheritance from the PHP script....
...eam Template Resources Home  Custom Template Resources ...
...source , including string: and eval: . When templates from strings are used, mak...
-
api.compile.all.config
...arty; // force compilation of all config files $smarty- compileAllConfig('.confi...
... compileAllConfig() compileAllConfig() compileallconfig, compileAllConfig() Prev...
... Next clearConfig() Home  compileAllTemplates() ...
-
api.register.filter
...ers: type defines the type of the filter. Valid values are "pre", "post", "outpu...
... register filters Description void registerFilter ( string type ,  Â...
...DefaultPluginHandler() Home  registerPlugin() ...
...re "pre", "post", "output" and "variable". callback defines the PHP callback. it...
-
variable.debugging
...up window that informs you of the included templates, variables assigned from ph...
...n also be enabled from the url with $debugging_ctrl . See also {debug} , $debug_...
...his enables the debugging console . The console is a javascript popup window tha...
...p  Next $debug_tpl Home  $debugging_ctrl ...
...ariables assigned from php and config file variables for the current script. It ...
-
api.display
...This displays the contents of a template. To return the contents of a template i...
...lays the template Description void display ( string template ,   ...
...Next disableSecurity() Home  enableSecurity() ...
...lid template resource type and path. As an optional second parameter, you can pa...
-
api.get.compile.dir
...plates are stored Description string getCompileDir (); Example 14.24. ...
... Next getCacheDir() Home  getConfigDir() ...
...? See also setCompileDir() and $compile_dir . Prev  Up  Next getCacheDir...
-
language.function.assign
...ables during the execution of a template . Note Assignment of variables in-templ...
...er 7. Built-in Functions  Next {assign} {assign} is used for assigning...
... Up  Next {append} Home  {block} ...
...tation that may be better handled in PHP. Use at your own discretion. Note See a...
-
caching.multiple.caches
...id . For each unique value of $my_cache_id , a separate cache will be generated ...
...eb browser) into Smarty or any PHP application. Although the above example of us...
...ticle_id was passed in the URL and is used as the $cache_id . Technical Note Be ...
... several different output contents depending on some condition, and you want sep...
...pter 15. Caching Home  Cache Groups ...
...pending on some condition, and you want separate caches for each one. You can do...
-
language.function.literal
...iteral} tags allow a block of data to be taken literally. This is typically used...
...template delimiter syntax. Anything within {literal}{/literal} tags is not inter...
... stylesheet blocks where {curly braces} would interfere with the template delimi...
...er 7. Built-in Functions  Next {literal} {literal} tags allow a block ...
...Next {ldelim},{rdelim} Home  {nocache} ...
...e. Be sure your javascript and CSS curly braces are surrounded by whitespace. Th...
-
language.function.html.radios
... group. It also takes care of which item is selected by default as well. Attribu...
...pter 8. Custom Functions  Next {html_radios} {html_radios} is a custom...
... Next {html_options} Home  {html_select_date} ...
...y Yes, unless using values and output n/a An associative array of values and out...
-
resources.custom
...ting resource plugin functions and registering them with Smarty. See resource pl...
...nds Template Resources Home  Chapter 17. Advanced Features ...
... resource plugin functions and registering them with Smarty. See resource plugin...
-
config.files
...to change the color scheme of an application, you would have to go through each ...
...ments into config files by any syntax that is not a valid config file syntax. We...
... Chapter 9. Config Files Chapter 9. Config Files chapter, 9, config,...
... Next {textformat} Home  Chapter 10. Debugging Console ...
...ig Files Config files are handy for designers to manage global template variable...
-
api.register.object
...the Best Practices section of the Smarty website. See the objects section for mo...
... in the templates Description void registerObject ( string object_name ,...
... Next registerPlugin() Home  registerResource() ...
...e sure that all properties and methods accessed from the template are for presen...
-
language.config.variables
... Variables loaded from config files Variables loaded from config files variables...
... Next Variable scopes Home  {$smarty} reserved variable ...
...load} . See also variables and $smarty reserved variables Prev  Up  Next...
-
plugins.compiler.functions
...ed only during compilation of the template. They are useful for injecting PHP co...
... Compiler Functions Compiler Functions compiler, functions Compiler Functions Pr...
... Next Block Functions Home  Prefilters/Postfilters ...
...s both a compiler function and a custom function registered under the same name,...
-
api.get.cache.dir
... output is stored Description string getCacheDir (); Example 14.23. ge...
... Up  Next fetch() Home  getCompileDir() ...
...; ? See also setCacheDir() and $cache_dir . Prev  Up  Next fetch() H...
-
api.unregister.resource
... name ); Pass in the name of the resource. Example 14.51. unregisterResou...
...a resource plugin Description void unregisterResource ( string name ); P...
...ext unregisterObject() Home  testInstall() ...
...ee also registerResource() and template resources Prev  Up  Next unregis...
-
language.function.debug
...age. This works regardless of the debug settings in the php script. Since this g...
...er 7. Built-in Functions  Next {debug} {debug} dumps the debug console...
... Next {config_load} Home  {extends} ...
...ate. If caching is enabled and a page is loaded from cache {debug} does show onl...
-
installing.smarty.extended
...tup This is a continuation of the basic installation , please read that first! A...
...Chapter 2. Installation  Next Extended Setup This is a continuation of...
...ext Basic Installation Home  Part II. Smarty For Template Designers...
...rty is to extend the class and initialize your Smarty environment. So instead of...
-
language.modifier.string.format
...ormatting. Parameter Position Type Required Default Description 1 string Yes n/a...
... Up  Next spacify Home  strip ...
...s, such as decimal numbers and such. Use the syntax for sprintf() for the format...
-
api.set.config.dir
...tConfigDir()); // chaining of method calls $smarty- setTemplateDir('./templates'...
... setConfigDir() setConfigDir() setconfigdir, setConfigDir() Prev  ChapterÂ...
... Next setCompileDir() Home  setPluginsDir() ...
...nfigDir() , addConfigDir() and $config_dir . Prev  Up  Next setCompileDi...
-
api.append
...e optional third parameter of TRUE , the value will be merged with the current a...
...an assigned array Description void append ( mixed var ); void append...
... Next addTemplateDir() Home  appendByRef() ...
...onverted to an array value and then appended to. You can explicitly pass name/va...
-
variable.force.compile
...y to (re)compile templates on every invocation. This setting overrides $compile_...
... Next $force_cache Home  $left_delimiter ...
...t this is FALSE . This is handy for development and debugging . It should never ...
-
variable.default.config.type
... $default_config_type $default_config_type , default_config_type $default_config...
... Next $debugging_ctrl Home  $default_modifiers ...
...y- configLoad('test.conf') and $smarty- configLoad('file:test.conf') are identic...
-
tips.componentized.templates
...d add this stock ticker to any application by merely including the template, and...
... Componentized Templates Componentized Templates componentized, templates Compon...
... Up  Next WAP/WML Home  Obfuscating E-mail Addresses ...
...ct, assign() the variables and display() the template. So lets say for example w...
-
api.register.resource
...h Smarty. Pass in the name of the Resource and the object extending Smarty_Resou...
...egister resources Description void registerResource ( string name ,  ...
... Next registerObject() Home  setCacheDir() ...
...rty_resource resource_handler ); Use this to dynamically register a Resource...
-
resources.streams
... is much the same a traditional template resource names. Smarty will first look ...
...ing Template Resources Home  Extends Template Resources ...
-
api.load.filter
...rgument specifies the type of the filter to load and can be one of the following...
...d a filter plugin Description void loadFilter ( string type ,   Â...
...p  Next isCached() Home  Smarty::muteExpectedErrors() ...
...type of the filter to load and can be one of the following: pre , post or output...
-
language.function.fetch
...ithin the $secure_dir path of the securty policy. See the Security section for d...
...pter 8. Custom Functions  Next {fetch} {fetch} is used to retrieve fil...
... Up  Next {eval} Home  {html_checkboxes} ...
... file system, http, or ftp and display the contents. If the file name begins wit...
-
api.unregister.cacheresource
... name ); Pass in the name of the CacheResource. Example 14.49. unregister...
...heResource plugin Description void unregisterCacheResource ( string name...
... Next templateExists() Home  unregisterFilter() ...
...so registerCacheResource() and the Custom CacheResource Implementation section. ...
-
language.function.cycle
...is used to alternate a set of values. This makes it easy to for example, alterna...
...pter 8. Custom Functions  Next {cycle} {cycle} is used to alternate a ...
...8. Custom Functions Home  {eval} ...
... be set to the first value and not advanced You can {cycle} through more than on...
-
api.get.registered.object
...registered object Description array getRegisteredObject ( string object_...
... Next getPluginsDir() Home  getTags() ...
...ect() , unregisterObject() and objects page Prev  Up  Next getPluginsDir...
-
language.modifier.strip.tags
...out markup tags, basically anything between and . Parameter Position Type Requir...
...ween and . Parameter Position Type Required Default Description 1 bool No TRUE T...
... Up  Next strip Home  to_charset ...
...basically anything between and . Parameter Position Type Required Default Descri...
-
language.modifier.indent
...you can specify the number of characters to indent. As an optional second parame...
... No 4 This determines how many characters to indent to. 2 string No (one space) ...
...dent This indents a string on each line, default is 4. As an optional parameter,...
... Next from_charset Home  lower ...
... See also strip , wordwrap and spacify . Prev  Up  Next from_charset ...
-
language.modifier.from_charset
...This is the exact opposite of the to_charset modifier . Parameter Position Type ...
...o ISO-8859-1 , UTF-8 , and any character set supported by mb_convert_encoding() ...
...modifier . Parameter Position Type Required Possible Values Default Description ...
... Up  Next escape Home  indent ...
...ng No ISO-8859-1 , UTF-8 , and any character set supported by mb_convert_encodin...
-
language.modifier.count.characters
...s used to count the number of characters in a variable. Parameter Position Type ...
... variable. Parameter Position Type Required Default Description 1 boolean No FAL...
...  Up  Next cat Home  count_paragraphs ...
...nt_words , count_sentences and count_paragraphs . Prev  Up  Next cat ...
-
api.add.config.dir
...dd a directory to the list of directories where config files are stored Descript...
... addConfigDir() addConfigDir() addconfigdir, addConfigDir() Prev  ChapterÂ...
... Smarty Class Methods Home  addPluginsDir() ...
...re config files are stored and specify array-key $smarty- addConfigDir('./config...
-
variable.default.config.handler.func
... $default_config_handler_func $default_config_handler_func , default_config_hand...
...$default_resource_type Home  $default_template_handler_func ...
... $default_config_handler_func $default_config_handler_func , default_config_hand...
-
advanced.features.objects
...the Best Practices section of the Smarty website. There are two ways to access t...
... and access them much like any other assigned variable. The first method has a m...
...template are for presentation purposes only. It is very easy to inject applicati...
... Up  Next Streams Home  Static Classes ...
...e sure that all properties and methods accessed from the template are for presen...
-
api.compile.all.templates
...ects you must register all of them before running this function. Note If you are...
...se is on own risk. Note If any template requires registered plugins, filters or ...
...l known templates Description string compileAllTemplates ( string extens...
...ext compileAllConfig() Home  configLoad() ...
-
api.clear.compiled.tpl
...lears the compiled version of the specified template resource Description voidÂ...
... clears the compiled version of the specified template resource Description voi...
... Next clearCache() Home  clearConfig() ...
-
language.modifier.count.paragraphs
...s used to count the number of paragraphs in a variable. Example 5.5. count...
...tally Slain. Death Causes Loneliness, Feeling of Isolation." ); ? Where template...
... Next count_characters Home  count_sentences ...
...aracters , count_sentences and count_words . Prev  Up  Next count_charac...
-
plugins.functions
... The output (return value) of the function will be substituted in place of the f...
...rm some other task without any output, eg the {assign} function. If the function...
... Template Functions Template Functions template, functions Template Functions Pr...
... Next Writing Plugins Home  Modifiers ...
...ball * Purpose: outputs a random magic answer * --------------------------------...
-
language.function.while
...c. The following is a list of recognized qualifiers, which must be separated fro...
...er 7. Built-in Functions  Next {while} {while} loops in Smarty have mu...
... Up  Next {strip} Home  Chapter 8. Custom Functions ...
...le} . All PHP conditionals and functions are recognized, such as || , or , , and...
-
variable.default.template.handler.func
...te_handler_func This function is called when a template cannot be obtained from ...
...lt_config_handler_func Home  $direct_access_security ...
... $default_template_handler_func $default_template_handler_func , default_templat...
-
language.function.include
...e variable that the output of {include} is assigned to, instead of being display...
...s in the current template. Any variables available in the current template are a...
...er 7. Built-in Functions  Next {include} {include} tags are used for i...
...t {if},{elseif},{else} Home  {include_php} ...
... template have local scope and are not visible inside the including template aft...
-
api.get.plugins.dir
...lugins are stored Description array getPluginsDir (); Example 14.27. g...
... Next getConfigVars() Home  getRegisteredObject() ...
...insDir() , addPluginsDir() and $plugins_dir . Prev  Up  Next getConfigVa...
-
language.function.math
...result is printed in place of the tag. The variables used in the equation are pa...
...equations in the template. Any numeric template variables may be used in the equ...
...pter 8. Custom Functions  Next {math} {math} allows the template desig...
... Up  Next {mailto} Home  {textformat} ...
... be used in the equations, and the result is printed in place of the tag. The va...
-
language.modifier.date.format
...amps or any string made up of month day year, parsable by php's strtotime() . De...
...ects , mysql timestamps or any string made up of month day year, parsable by php...
... or any string made up of month day year, parsable by php's strtotime() . Design...
...  Next count_words Home  default ...
...format This formats a date and time into the given strftime() format. Dates can ...
-
variable.left.delimiter
... Next $force_compile Home  $locking_timeout ...
... See also $right_delimiter and escaping smarty parsing . Prev  Up  Next ...
-
language.function.include.php
...m the application code. As of Smarty 3.1 the {include_php} tags are only availab...
...w Db(); $db- query('select url, name from navigation order by name'); $this- ass...
...er 7. Built-in Functions  Next {include_php} IMPORTANT NOTICE {include...
...Up  Next {include} Home  {insert} ...
... variables from a mysql db and assign them to the template require_once('databas...
-
variable.auto.literal
... and } will be ignored so long as they are surrounded by white space. This behav...
...Smarty Class Variables Home  $autoload_filters ...
...he Smarty delimiter tags { and } will be ignored so long as they are surrounded ...
-
api.enable.security
...l parameter. It's the name of the class with defines the security policy paramet...
...template security Description string enableSecurity ( string securitycla...
...Up  Next display() Home  fetch() ...
...e also disableSecurity() , and Security . Prev  Up  Next display() H...
-
variable.config.overwrite
...f you want to store arrays of data in config files, just list each element multi...
... $config_overwrite $config_overwrite , config_overwrite $config_overwrite Prev ...
...  Next $config_dir Home  $config_read_hidden ...
...earConfig() , configLoad() and the config files section . Prev  Up  Next...
-
api.disable.security
...template security Description string disableSecurity (); This disables secur...
... Next createTemplate() Home  display() ...
...ee also enableSecurity() , and Security . Prev  Up  Next createTemplate(...
-
language.function.section
...equentially indexed arrays of data , unlike {foreach} which is used to loop over...
...me of the {section} can be anything you like, made up of letters, numbers and un...
... {section},{sectionelse} {section},{sectionelse} , ldelim, section, rdelim, ldel...
...ay('name' = 'John Smith', 'home' = '555-555-5555', 'cell' = '666-555-5555', 'ema...
...g a {section} loop can do, and has a simpler and easier syntax. It is usually pr...
-
api.add.template.dir
...dd a directory to the list of directories where templates are stored Description...
...plates are stored Description Smarty addTemplateDir ( string|array templ...
... Next addPluginsDir() Home  append() ...
...where templates are stored and specify array-key $smarty- addTemplateDir('./temp...
-
resources
... 16. Resources Table of Contents File Template Resources Templates from $t...
...emplate_dir Templates from any directory Windows Filepaths String Template Resou...
...16. Resources Table of Contents File Template Resources Templates from $templ...
...m Cache Implementation Home  String Template Resources ...
...ed by the appropriate path and template name. If a resource is not explicitly gi...
-
variable.compile.check
...check Upon each invocation of the PHP application, Smarty tests to see if the cu...
... Next $compile_check Upon each invocation of the PHP application, Smarty tes...
... Next $caching_type Home  $compile_dir ...
...f you change this to FALSE and a template file is changed, you will *not* see th...
-
language.function.ldelim
.../literal} to escape blocks of text eg Javascript or CSS. See also the compliment...
...er 7. Built-in Functions  Next {ldelim},{rdelim} {ldelim} and {rdelim}...
... Up  Next {insert} Home  {literal} ...
...{ldelim},{rdelim} {ldelim} and {rdelim} are used for escaping template delimiter...
-
api.variables
...arty Class Variables Table of Contents $allow_php_templates $auto_literal $autol...
... Class Variables Table of Contents $allow_php_templates $auto_literal $autoload_...
...er 12. Constants Home  $auto_literal ...
...urce_type $default_config_handler_func $default_template_handler_func $direct_ac...
-
tips.wap
...L templates require a php Content-Type header to be passed along with the templa...
... Up  Next Dates Home  Componentized Templates ...
-
language.function.call
...hich contains the the name of the template function. Values for variables can be...
...er 7. Built-in Functions  Next {call} {call} is used to call a templat...
... Up  Next {block} Home  {capture} ...
...menu data=$menu} {* short-hand *} Will generate the following output * item1 * i...
-
api.clear.config
... clearConfig() clearConfig() clearconfig, clearConfig() Prev  Chapter 14....
...learCompiledTemplate() Home  compileAllConfig() ...
...onfig_load} , configLoad() and clearAssign() . Prev  Up  Next clearCompi...
-
api.register.cacheresource
...h Smarty. Pass in the name of the CacheResource and the object extending Smarty_...
...er CacheResources Description void registerCacheResource ( string name ,...
...::muteExpectedErrors() Home  registerClass() ...
...acheResource resource_handler ); Use this to dynamically register a CacheRes...
-
language.function.function
...a plugin function. Instead of writing a plugin that generates presentational con...
...function Note You can pass any number of parameter to the template function when...
... {function} {function} , ldelim, function, rdelim, {function} Prev  Chapter...
...foreach},{foreachelse} Home  {if},{elseif},{else} ...
...unctions within a template and call them just like a plugin function. Instead of...
-
variable.use.include.path
...y does not filter elements of the include_path. That means a ".:" within your in...
...ered, it is preferred over anything potentially accessible through the include_p...
...d not design your applications to rely on the include_path, as this may - depend...
... Next $trusted_dir Home  $use_sub_dirs ...
...he File Template Resource handler and the plugin loader to resolve the directori...
-
language.function.capture
...used to collect the output of the template between the tags into a variable inst...
... instead of displaying it. Any content between {capture name='foo'} and {/captur...
...er 7. Built-in Functions  Next {capture} {capture} is used to collect ...
... Up  Next {call} Home  {config_load} ...
...tween {capture name='foo'} and {/capture} is collected into the variable specifi...
-
api.set.compile.dir
...templates_c'); // chaining of method calls $smarty- setTemplateDir('./templates'...
...plates are stored Description Smarty setCompileDir ( string compile_dir ...
... Next setCacheDir() Home  setConfigDir() ...
...? See also getCompileDir() and $compile_dir . Prev  Up  Next setCacheDir...
-
language.modifier.count.words
...s used to count the number of words in a variable. Example 5.7. count_word...
...rs Will Hear Car Talk at Noon.'); ? Where template is: {$articleTitle} {$article...
... Next count_sentences Home  date_format ...
...racters , count_paragraphs and count_sentences . Prev  Up  Next count_se...
-
api.clear.all.cache
...re template cache Description void clearAllCache ( int expire_time ); As...
... Next clearAllAssign() Home  clearAssign() ...
... clearCache() , isCached() and the caching page. Prev  Up  Next clearAll...
-
language.modifier.nl2br
... "\n" line breaks will be converted to html br / tags in the given variable. Thi...
... Up  Next lower Home  regex_replace ...
...rd_wrap , count_paragraphs and count_sentences . Prev  Up  Next lowerÂ...
-
installation
... 2. Installation Table of Contents Requirements Basic Installation Extended ...
...Chapter 2. Installation Chapter 2. Installation chapter, 2, installa...
...1. What is Smarty? Home  Basic Installation ...
-
api.create.data
... variables assigned to any of the objects in it's parent chain. Data objects are...
...cess variables assigned to any of the objects in it's parent chain. Data objects...
...tes a data object Description string createData ( object parent ); strin...
... Next configLoad() Home  createTemplate() ...
...(); ? See also display() , and createTemplate() , Prev  Up  Next configL...
-
variable.error.reporting
...ror_reporting level inside of display() and fetch() . Smarty 3.1.2 introduced th...
...en this value is set to a non-null-value it's value is used as php's error_repor...
...direct_access_security Home  $escape_html ...
... level inside of display() and fetch() . Smarty 3.1.2 introduced the muteExpecte...
-
variable.direct.access.security
...This is a compile time option. If you change the setting you must make sure that...
..._template_handler_func Home  $error_reporting ...
... Next $default_template_handler_func Home  $error_reporting ...
-
variable.force.cache
...rty to (re)cache templates on every invocation. It does not override the $cachin...
... Next $escape_html Home  $force_compile ...
-
plugins.modifiers
...er is to operate. The rest of the parameters are optional, depending on what kin...
...unctions. It does not have any additional parameters. ?php /* * Smarty plugin * ...
...Modifiers are little functions that are applied to a variable in the template be...
...ext Template Functions Home  Block Functions ...
...g in the middle of a word, and * appending the $etc string. * ------------------...
-
variable.merge.compiled.includes
...the compiled template code of subtemplates into the compiled code of the main te...
...peed of templates using a many different sub-templates. Individual sub-templates...
... by setting the inline option flag within the {include} tag. $merge_compiled_inc...
... Next $locking_timeout Home  $php_handling ...
...timeout Home  $php_handling ...
-
api.register.plugin
...ers: type defines the type of the plugin. Valid values are "function", "block", ...
... register plugins Description void registerPlugin ( string type ,  Â...
... Next registerFilter() Home  registerObject() ...
...tion", "block", "compiler" and "modifier". name defines the name of the plugin. ...
-
api.register.class
... in the templates Description void registerClass ( string class_name , ...
...egisterCacheResource() Home  registerDefaultPluginHandler() ...
...ee also registerObject() , and Security . Prev  Up  Next registerCacheRe...
-
api.clear.cache
...specific template Description void clearCache ( string template ,  Â...
... Next clearAssign() Home  clearCompiledTemplate() ...
...? See also clearAllCache() and caching section. Prev  Up  Next clearAssi...
-
api.clear.all.assign
...— clears the values of all assigned variables Description void clearA...
...ssigned variables Description void clearAllAssign (); Example 14.8. cl...
... Next assignByRef() Home  clearAllCache() ...
...tTemplateVars() , assign() and append() Prev  Up  Next assignByRef() ...
-
api.set.plugins.dir
...PluginsDir()); // chaining of method calls $smarty- setTemplateDir('./templates'...
...lugins are stored Description Smarty setPluginsDir ( string|array plugin...
... Next setConfigDir() Home  setTemplateDir() ...
...insDir() , addPluginsDir() and $plugins_dir . Prev  Up  Next setConfigDi...
-
api.mute.expected.errors
..., that if you've registerd any custom error handlers after the muteExpectedError...
...nerated by Smarty Description string muteExpectedErrors (); muteExpectedErro...
... Next loadFilter() Home  registerCacheResource() ...
... mutes expected warnings and notices deliberately generated by Smarty Descript...
-
language.modifier.cat
... Next cat This value is concatenated to the given variable. Parameter Position...
... Variable Modifiers Home  count_characters ...
-
api.get.config.dir
... getConfigDir() getConfigDir() getconfigdir, getConfigDir() Prev  ChapterÂ...
... Next getCompileDir() Home  getConfigVars() ...
...nfigDir() , addConfigDir() and $config_dir . Prev  Up  Next getCompileDi...
-
advanced.features.prefilters
...e prefilters are PHP functions that your templates are ran through before they a...
... Next Static Classes Home  Postfilters ...
...ode as the first argument, and expect the function to return the resulting templ...
-
variable.compile.locking
...ids concurrent compilation of the same template. Compile locking is enabled by d...
...ng Compile locking avoids concurrent compilation of the same template. Compile l...
...  Next $compile_id Home  $compiler_class ...
-
variable.cache.id
...ple from different content of the same template. See the caching section for mor...
...id to each and every function call, you can set this $cache_id and it will be us...
...p  Next $cache_dir Home  $cache_lifetime ...
...the same $cache_id to each and every function call, you can set this $cache_id a...
-
language.function.html.options
...signed data. It takes care of which item(s) are selected by default as well. Att...
... {html_options} {html_options} , ldelim, html_options, rdelim, {html_options} Pr...
... Next {html_image} Home  {html_radios} ...
...y Yes, unless using values and output n/a An associative array of values and out...