-
caching
... Chapter 15. Caching Chapter 15. Caching chapter, 15, caching Chapte...
... Chapter 15. Caching Chapter 15. Caching chapter, 15, caching Chapte...
...etc. Since templates are dynamic, it is important to be careful what you are cac...
...URRENT); $smarty- display('index.tpl'); ? With caching enabled, the function cal...
... Chapter 15. Caching Chapter 15. Caching chapter, 15, caching Chapte...
...ing the front page of your website that does not change its content very often, ...
... Chapter 15. Caching Chapter 15. Caching chapter, 15, caching Chapte...
-
advanced.features.objects
...ns can be accessed (beginningwith '_'). If a method and property of the same nam...
...ns can be accessed (beginningwith '_'). If a method and property of the same nam...
...ns that are difficult to manage. See the Best Practices section of the Smarty we...
...$myobj); $smarty- display('index.tpl'); ? And here's how to access your objects ...
...ns can be accessed (beginningwith '_'). If a method and property of the same nam...
...ices section of the Smarty website. There are two ways to access them. One way i...
...ns can be accessed (beginningwith '_'). If a method and property of the same nam...
-
installing.smarty.basic
...T edit. They are shared among all applications and only get changed when you upg...
...T edit. They are shared among all applications and only get changed when you upg...
...Smarty uses a PHP constant named SMARTY_DIR which is the full system file path t...
...com/ guestbook/ templates/ index.tpl templates_c/ configs/ cache/ htdocs/ index....
...T edit. They are shared among all applications and only get changed when you upg...
...T edit. They are shared among all applications and only get changed when you upg...
-
api.get.tags
...y template Description string getTags ( object template ); This function...
...y template Description string getTags ( object template ); This function...
...ty Class Methods  Next Name getTags() — return tags used by template ...
...= $smarty- createTemplate('index.tpl'); // get tags $tags = $smarty- getTags($tp...
...y template Description string getTags ( object template ); This function...
...y template Description string getTags ( object template ); This function...
-
language.function.append
...{append} is used for creating or appending template variable arrays during the e...
...{append} is used for creating or appending template variable arrays during the e...
...ion. Attributes: Attribute Name Type Required Default Description var string Yes...
...a The value being assigned index string No n/a The index for the new array eleme...
...{append} is used for creating or appending template variable arrays during the e...
...{append} is used for creating or appending template variable arrays during the e...
-
variable.default.resource.type
...fault value is file , meaning that $smarty- display('index.tpl') and $smarty- di...
...fault value is file , meaning that $smarty- display('index.tpl') and $smarty- di...
...ing that $smarty- display('index.tpl') and $smarty- display('file:index.tpl') ar...
...fault value is file , meaning that $smarty- display('index.tpl') and $smarty- di...
...fault value is file , meaning that $smarty- display('index.tpl') and $smarty- di...
-
language.variables.smarty
...Example 4.8. Displaying request variables {* display value of page from UR...
...Example 4.8. Displaying request variables {* display value of page from UR...
...e value of the cookie "username" ($_COOKIE['username']) *} {$smarty.cookies.user...
...ET) http://www.example.com/index.php?page=foo *} {$smarty.get.page} {* display t...
...Example 4.8. Displaying request variables {* display value of page from UR...
...Example 4.8. Displaying request variables {* display value of page from UR...
-
api.template.exists
...l templateExists ( string template ); It can accept either a path to the...
...l templateExists ( string template ); It can accept either a path to the...
...ty Class Methods  Next Name templateExists() — checks whether the spe...
...php // set the filename eg index.inc.tpl $mid_template = $_GET['page'].'.inc.tpl...
...l templateExists ( string template ); It can accept either a path to the...
...l templateExists ( string template ); It can accept either a path to the...
-
smarty.for.designers
...unctions Attributes Embedding Vars in Double Quotes Math Escaping Smarty Parsing...
...unctions Attributes Embedding Vars in Double Quotes Math Escaping Smarty Parsing...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
...unctions Attributes Embedding Vars in Double Quotes Math Escaping Smarty Parsing...
...unctions Attributes Embedding Vars in Double Quotes Math Escaping Smarty Parsing...
-
language.syntax.variables
...d referenced with surrounding #hashmarks#, or via the $smarty.config variable. E...
...d referenced with surrounding #hashmarks#, or via the $smarty.config variable. E...
...e {assign} Many other combinations are allowed {$foo.bar.baz} {$foo.$bar.$baz} {...
...ou can reference arrays by index numerically or non-numerically. Also reference ...
...d referenced with surrounding #hashmarks#, or via the $smarty.config variable. E...
...d referenced with surrounding #hashmarks#, or via the $smarty.config variable. E...
-
api.assign.by.ref
...void assignByRef ( string varname ,          ...
...void assignByRef ( string varname ,          ...
...ty Class Methods  Next Name assignByRef() — assign values by referenc...
...ul if you want a PHP array index value to be affected by its reassignment from a...
...void assignByRef ( string varname ,          ...
...void assignByRef ( string varname ,          ...
-
language.variable.scopes
... variable scope. By assigning variables to individual data or template objects y...
... variable scope. By assigning variables to individual data or template objects y...
...= $smarty- createTemplate('index.tpl'); $tpl- assign('bar','bar-template'); // a...
... variable scope. By assigning variables to individual data or template objects y...
... variable scope. By assigning variables to individual data or template objects y...
-
api.create.template
...e createTemplate ( string template ,         Â...
...e createTemplate ( string template ,         Â...
...ty Class Methods  Next Name createTemplate() — returns a template obj...
...= $smarty- createTemplate('index.tpl'); // assign variable to template scope $tp...
...e createTemplate ( string template ,         Â...
...e createTemplate ( string template ,         Â...
-
api.append.by.ref
...void appendByRef ( string varname ,          ...
...void appendByRef ( string varname ,          ...
...ty Class Methods  Next Name appendByRef() — append values by referenc...
...ul if you want a PHP array index value to be affected by its reassignment from a...
...void appendByRef ( string varname ,          ...
...void appendByRef ( string varname ,          ...
-
api.is.cached
...on bool isCached ( string template ,         Â...
...on bool isCached ( string template ,         Â...
...ty Class Methods  Next Name isCached() — returns true if there is a v...
...T); if(!$smarty- isCached('index.tpl')) { // do database calls, assign vars here...
...on bool isCached ( string template ,         Â...
...on bool isCached ( string template ,         Â...
-
language.builtin.functions
...rt of the smarty template engine. They are compiled into corresponding inline PH...
...rt of the smarty template engine. They are compiled into corresponding inline PH...
...om functions with the same name; and you should not need to modify the built-in ...
...} {foreach},{foreachelse} @index @iteration @first @last @show @total {break} {c...
...rt of the smarty template engine. They are compiled into corresponding inline PH...
...rt of the smarty template engine. They are compiled into corresponding inline PH...
-
language.function.html.table
...arated list of column heading names or an array of column heading names.if the c...
...arated list of column heading names or an array of column heading names.if the c...
... an HTML table . Attribute Name Type Required Default Description loop array Yes...
...dd"') ); $smarty- display('index.tpl'); ? The variables assigned from php could ...
...arated list of column heading names or an array of column heading names.if the c...
...arated list of column heading names or an array of column heading names.if the c...
-
advanced.features.template.settings
... Changing settings by template Changing settings by template changing, settings,...
... Changing settings by template Changing settings by template changing, settings,...
...= $smarty- createTemplate('index.tpl); $tpl- cache_lifetime = 600; //or $tpl- se...
... Changing settings by template Changing settings by template changing, settings,...
... Changing settings by template Changing settings by template changing, settings,...
-
bugs
...on of Smarty, or check the website. Prev  Up  Chapter 22. Resource...
-
language.function.foreach
...{foreach} is used for looping over arrays of data. {foreach} has a simpler and c...
...{foreach} is used for looping over arrays of data. {foreach} has a simpler and c...
...syntax does not accept any named attributes. This syntax is new to Smarty 3, how...
... {foreach} properties are @index , @iteration , @first , @last , @show , @total ...
...{foreach} is used for looping over arrays of data. {foreach} has a simpler and c...
...{foreach} is used for looping over arrays of data. {foreach} has a simpler and c...
-
caching.custom
... Chapter 15. Caching  Next Custom Cache Implementation As an altern...
... Chapter 15. Caching  Next Custom Cache Implementation As an altern...
... Implementation As an alternative to using the default file-based caching mechan...
...L, * PRIMARY KEY (`id`), * INDEX(`name`), * INDEX(`cache_id`), * INDEX(`compile_...
... Chapter 15. Caching  Next Custom Cache Implementation As an altern...
... Chapter 15. Caching  Next Custom Cache Implementation As an altern...
-
troubleshooting
...ter 20. Troubleshooting Chapter 20. Troubleshooting chapter, 20, tro...
...ter 20. Troubleshooting Chapter 20. Troubleshooting chapter, 20, tro...
...utes or malformed variable names. If this happens, you will see an error similar...
...rrors Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah...
...ter 20. Troubleshooting Chapter 20. Troubleshooting chapter, 20, tro...
...ter 20. Troubleshooting Chapter 20. Troubleshooting chapter, 20, tro...
-
preface
...rty? Smarty is a template engine for PHP, facilitating the separation of present...
...rty? Smarty is a template engine for PHP, facilitating the separation of present...
...eployment and easier maintenance. Smarty syntax requires no working knowledge of...
...rty? Smarty is a template engine for PHP, facilitating the separation of present...
...ices section of the Smarty website. How does it work? Under the hood, Smarty "co...
...rty? Smarty is a template engine for PHP, facilitating the separation of present...
-
advanced.features.static.classes
...ded. This ties the underlying application code structure directly to the present...
...ded. This ties the underlying application code structure directly to the present...
...arty variable bar as class name Prev  Up  Next Objects Home  Pref...
...ded. This ties the underlying application code structure directly to the present...
...ices section of the Smarty website. Example 17.10. static class access syn...
...ded. This ties the underlying application code structure directly to the present...
-
advanced.features.outputfilters
...he plugins directory by using the loadFilter() method or by setting the $autoloa...
...he plugins directory by using the loadFilter() method or by setting the $autoloa...
...l($tpl_output, Smarty_Internal_Template $template) { $tpl_output = preg_replace(...
...email"); $smarty- display("index.tpl'); // now any occurrence of an email addres...
...he plugins directory by using the loadFilter() method or by setting the $autoloa...
...he plugins directory by using the loadFilter() method or by setting the $autoloa...
-
plugins.resources
... Chapter 18. Extending Smarty With Plugins  Next Resources Resource p...
... Chapter 18. Extending Smarty With Plugins  Next Resources Resource p...
...resource by prepending its name to the template you're addressing: foobarxyz:you...
...pt $smarty- display("mysql:index.tpl"); ? And from within Smarty template: {incl...
... Chapter 18. Extending Smarty With Plugins  Next Resources Resource p...
... Chapter 18. Extending Smarty With Plugins  Next Resources Resource p...
-
language.modifier.strip
...newlines and tabs with a single space, or with the supplied string. Note If you ...
...newlines and tabs with a single space, or with the supplied string. Note If you ...
... one."); $smarty- display('index.tpl'); ? Where template is: {$articleTitle} {$a...
...newlines and tabs with a single space, or with the supplied string. Note If you ...
...newlines and tabs with a single space, or with the supplied string. Note If you ...
-
caching.cacheable
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
...y of Output If caching is enabled normally the whole final output of the page ge...
...); if (!$smarty- isCached('index.tpl')) { // fetch $obj from db and assign... $s...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
-
caching.groups
... Chapter 15. Caching  Next Cache Groups You can do more elaborate g...
... Chapter 15. Caching  Next Cache Groups You can do more elaborate g...
... If you specify a template name such as clearCache('foo.tpl','a|b|c') then Smart...
...structure like themes/blue/index.tpl and you want to be able to clear all the ca...
... Chapter 15. Caching  Next Cache Groups You can do more elaborate g...
... Chapter 15. Caching  Next Cache Groups You can do more elaborate g...
-
api.assign
...r ); void assign ( string varname ,          ...
...r ); void assign ( string varname ,          ...
...ty Class Methods  Next Name assign() — assign variables/objects to th...
...r ); void assign ( string varname ,          ...
...ices section of the Smarty website. Example 14.6. assign() ?php // passing...
...r ); void assign ( string varname ,          ...
-
language.variables
... so that it is the only thing contained between them. Example 4.1. Example...
... so that it is the only thing contained between them. Example 4.1. Example...
...modifiers , inside conditional expressions, etc. To print a variable, simply enc...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
... so that it is the only thing contained between them. Example 4.1. Example...
... so that it is the only thing contained between them. Example 4.1. Example...
-
advanced.features.postfilters
...he plugins directory by using the loadFilter() function or by setting the $autol...
...he plugins directory by using the loadFilter() function or by setting the $autol...
...t($tpl_source, Smarty_Internal_Template $template) { return " ?php echo \" !-- C...
...mment'); $smarty- display('index.tpl'); ? The postfilter above will make the com...
...he plugins directory by using the loadFilter() function or by setting the $autol...
...he plugins directory by using the loadFilter() function or by setting the $autol...
-
api.fetch
...ate output Description string fetch ( string template ,     ...
...ate output Description string fetch ( string template ,     ...
...ty Class Methods  Next Name fetch() — returns the template output Des...
... $output = $smarty- fetch('index.tpl', $cache_id); // do something with $output ...
...ate output Description string fetch ( string template ,     ...
...ate output Description string fetch ( string template ,     ...
-
api.display
...ion void display ( string template ,         Â...
...ion void display ( string template ,         Â...
...ty Class Methods  Next Name display() — displays the template Descrip...
...ist if(!$smarty- isCached('index.tpl')) { // dummy up some data $address = '245 ...
...ion void display ( string template ,         Â...
...ion void display ( string template ,         Â...
-
language.function.assign
...assign} is used for assigning template variables during the execution of a templ...
...assign} is used for assigning template variables during the execution of a templ...
...ars. Attributes: Attribute Name Type Required Default Description var string Yes...
...ole_page = $smarty- fetch('index.tpl'); // this will output 'smarty' as the temp...
...assign} is used for assigning template variables during the execution of a templ...
...assign} is used for assigning template variables during the execution of a templ...
-
caching.multiple.caches
... Chapter 15. Caching  Next Multiple Caches Per Page You can have mu...
... Chapter 15. Caching  Next Multiple Caches Per Page You can have mu...
...ay that a call to display('index.tpl') may have several different output content...
... Chapter 15. Caching  Next Multiple Caches Per Page You can have mu...
... Chapter 15. Caching  Next Multiple Caches Per Page You can have mu...
-
resources.custom
... can retrieve templates using whatever possible source you can access with PHP: ...
... can retrieve templates using whatever possible source you can access with PHP: ...
...ing under another resource name. Example 16.10. Using custom resources ?ph...
...pt $smarty- display("mysql:index.tpl"); ? And from within Smarty template: {incl...
... can retrieve templates using whatever possible source you can access with PHP: ...
... can retrieve templates using whatever possible source you can access with PHP: ...
-
api.register.object
...d registerObject ( string object_name ,         ...
...d registerObject ( string object_name ,         ...
...ty Class Methods  Next Name registerObject() — register an object for...
...d registerObject ( string object_name ,         ...
...ices section of the Smarty website. See the objects section for more information...
...d registerObject ( string object_name ,         ...
-
plugins.compiler.functions
... Chapter 18. Extending Smarty With Plugins  Next Compiler Functions C...
... Chapter 18. Extending Smarty With Plugins  Next Compiler Functions C...
... registered under the same name, the compiler function has precedence. mixed sma...
...hing like this: ?php echo 'index.tpl compiled at 2002-02-20 20:02'; ? See also r...
... Chapter 18. Extending Smarty With Plugins  Next Compiler Functions C...
... Chapter 18. Extending Smarty With Plugins  Next Compiler Functions C...
-
installing.smarty.extended
...instead of repeatedly setting directory paths, assigning the same vars, etc., we...
...instead of repeatedly setting directory paths, assigning the same vars, etc., we...
...URRENT; $this- assign('app_name', 'Guest Book'); } } ? Now lets alter the index....
...; } } ? Now lets alter the index.php file to use setup.php : Example 2.11.Â...
...instead of repeatedly setting directory paths, assigning the same vars, etc., we...
...instead of repeatedly setting directory paths, assigning the same vars, etc., we...
-
tips.componentized.templates
...es Traditionally, programming templates into your applications goes as follows: ...
...es Traditionally, programming templates into your applications goes as follows: ...
...nentized Templates Traditionally, programming templates into your applications g...
...sign'], $ticker_info); } ? index.tpl {load_ticker symbol='SMARTY' assign='ticker...
...es Traditionally, programming templates into your applications goes as follows: ...
...es Traditionally, programming templates into your applications goes as follows: ...
-
api.register.resource
... registerResource ( string name ,          Â...
... registerResource ( string name ,          Â...
...ty Class Methods  Next Name registerResource() — dynamically register...
...marty- display('c:/path/to/index.tpl'); Note Prior to Smarty 3.1 registerResourc...
... registerResource ( string name ,          Â...
... registerResource ( string name ,          Â...
-
index
... Next Smarty - the compiling PHP template engine Monte Ohrt monte at ohrt dot c...
...m Uwe Tews uwe dot tews at googlemail dot com Copyright © 2001-2011 New Digit...
... Next Smarty - the compiling PHP template engine Monte Ohrt monte at ohrt dot c...
...” displays the template enableSecurity() — enables template security fe...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
... Next Smarty - the compiling PHP template engine Monte Ohrt monte at ohrt dot c...
... Next Smarty - the compiling PHP template engine Monte Ohrt monte at ohrt dot c...
-
api.clear.compiled.tpl
...learCompiledTemplate ( string tpl_file ,         Â...
...learCompiledTemplate ( string tpl_file ,         Â...
...ty Class Methods  Next Name clearCompiledTemplate() — clears the comp...
...ty- clearCompiledTemplate('index.tpl'); // clear entire compile directory $smart...
...learCompiledTemplate ( string tpl_file ,         Â...
...learCompiledTemplate ( string tpl_file ,         Â...
-
language.function.section
...e} A {section} is for looping over sequentially indexed arrays of data , unlike ...
...e} A {section} is for looping over sequentially indexed arrays of data , unlike ...
... {foreach} loop. Attribute Name Type Required Default Description name string Ye...
... looping over sequentially indexed arrays of data , unlike {foreach} which is us...
...e} A {section} is for looping over sequentially indexed arrays of data , unlike ...
...e} A {section} is for looping over sequentially indexed arrays of data , unlike ...
-
resources
...tory Windows Filepaths String Template Resources Stream Template Resources Exten...
...tory Windows Filepaths String Template Resources Stream Template Resources Exten...
...ropriate path and template name. If a resource is not explicitly given, the valu...
...dir ?php $smarty- display('index.tpl'); $smarty- display('file:index.tpl'); // s...
...tory Windows Filepaths String Template Resources Stream Template Resources Exten...
...template_dir . This allows websites employing multiple sets of templates better ...
...tory Windows Filepaths String Template Resources Stream Template Resources Exten...
-
api.create.data
...ata object Description string createData ( object parent ); string c...
...ata object Description string createData ( object parent ); string c...
...ty Class Methods  Next Name createData() — creates a data object Desc...
...= $smarty- createTemplate('index.tpl',$data); // display the template $tpl- disp...
...ata object Description string createData ( object parent ); string c...
...ata object Description string createData ( object parent ); string c...
-
api.clear.cache
... void clearCache ( string template ,         Â...
... void clearCache ( string template ,         Â...
...ty Class Methods  Next Name clearCache() — clears the cache for a spe...
...plate $smarty- clearCache('index.tpl'); // clear the cache for a particular cach...
... void clearCache ( string template ,         Â...
... void clearCache ( string template ,         Â...
-
advanced.features.prefilters
...his is good for preprocessing your templates to remove unwanted comments, keepin...
...his is good for preprocessing your templates to remove unwanted comments, keepin...
...s($tpl_source, Smarty_Internal_Template $template) { return preg_replace("/ !--#...
...ments'); $smarty- display('index.tpl'); ? See also registerFilter() , postfilter...
...his is good for preprocessing your templates to remove unwanted comments, keepin...
...his is good for preprocessing your templates to remove unwanted comments, keepin...