-
preface
...d code into templates that doesn't belong there (you just handed them a swiss-ar...
...signers can learn PHP, and they may already be familiar with it. The issue isn't...
...these goals: clean separation of presentation from application code PHP backend,...
...ion of the Smarty website. How does it work? Under the hood, Smarty "compiles" (...
...d designers quick and easy to maintain syntax easy to understand, no PHP knowled...
...rty gives you the tools to make a clean separation of presentation from applicat...
... fastest from a pure script-execution point of view, many would argue that the P...
-
language.function.html.select.time
...tion that creates time dropdowns for you. It can display any or all of hour, min...
...pter 8. Custom Functions  Next {html_select_time} {html_select_time} i...
...v  Chapter 8. Custom Functions  Next {html_select_time} {html_sele...
...s value. This is useful to make the select-boxes read “ Please select â...
...stamp What date/time to pre-select. If an array is given, the attributes field_a...
-
language.function.php
...irectly into the template. They will not be escaped, regardless of the $php_hand...
...er 7. Built-in Functions  Next {php} IMPORTANT NOTICE {php} tags are d...
... {php} tags allow PHP code to be embedded directly into the template. They will ...
...arX} /strong is my fav ice cream :-) See also $php_handling , {include_php} , {i...
... Chapter 7. Built-in Functions  Next {php} IMPORTANT NOTICE {php} ...
-
language.function.html.select.date
...tion that creates date dropdowns. It can display any or all of year, month, and ...
...pter 8. Custom Functions  Next {html_select_date} {html_select_date} i...
...v  Chapter 8. Custom Functions  Next {html_select_date} {html_sele...
...s value. This is useful to make the select-boxes read “ Please select â...
...w are printed as name/value-pairs inside the select tags of day, month and year....
-
variable.escape.html
...This is a compile time option. If you change the setting you must make sure that...
..._html Setting $escape_html to TRUE will escape all template variable output by w...
...hange the setting you must make sure that the templates get recompiled. Prev Â...
-
caching
... can speed things up tremendously, especially templates with longer computation ...
...he template name. Although they end in the .php extention, they are not intended...
... 15. Caching Table of Contents Setting Up Caching Multiple Caches Per Page C...
...at you are caching and for how long. For instance, if you are displaying the fro...
...Cacheability of Plugins Custom Cache Implementation Caching is used to speed up ...
...y the minute, it would not make sense to cache this page. Setting Up Caching The...
.../ uses the value of $smarty- cacheLifetime() to determine // the number of secon...
-
variable.default.modifiers
... Up  Next $default_config_type Home  $default_resource_type ...
...s is an array of modifiers to implicitly apply to every variable in a template. ...
...y('escape:"htmlall"') . To make a variable exempt from default modifiers, add th...
...plate. For example, to HTML-escape every variable by default, use array('escape:...
-
language.function.extends
...er 7. Built-in Functions  Next {extends} {extends} tags are used in ch...
...tax for template resources to extend files outside of the $template_dir director...
...tends file=$parent_file} , make sure you include $parent_file in the $cache_id ....
... Chapter 7. Built-in Functions  Next {extends} {extends} tags are ...
-
caching.cacheable
...second(s)'; }else{ return 'done'; } } $smarty- registerPlugin('function','remain...
...are not cached by default. They can be declared to be cached with the fourth par...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
...t of the page gets cached. However Smarty3 offers several options how to exclude...
...offers several options how to exclude sections of your output from caching. Gene...
...d in nocache mode you must make sure that all other variables used by that tag a...
...variables used within a non-cached section are also assigned from PHP when the p...
-
what.is.smarty
...ication logic. This change does not affect the template designer, the content wi...
...body are content elements, they contain no information about how they will be pr...
...e way to separate application logic and content from its presentation. This is b...
...ntain no information about how they will be presented. They are passed into Smar...
...cilitates a manageable way to separate application logic and content from its pr...
...refore, the programmer can make changes to the application logic without the nee...
...ing table row colors, upper-casing a variable, looping over an array of data and...
-
api.assign
...a row from a database (eg adodb) $sql = 'select id, name, email from contacts wh...
... to the templates Description void assign ( mixed var ); void assign...
... assign variables/objects to the templates Description void assign ( mixed...
...ng name/value pairs $smarty- assign('Name', 'Fred'); $smarty- assign('Address', ...
-
language.variables
...d by preceding them with a dollar ( $ ) sign. Example 4.2. Assigned variab...
...4. Variables Table of Contents Variables assigned from PHP Associative array...
...ditional expressions, etc. To print a variable, simply enclose it in the delimit...
...name}, glad to see you can make it. br / {* this will not work as $variables are...
...rty = new Smarty(); $smarty- assign('firstname', 'Doug'); $smarty- assign('lastn...
-
advanced.features.postfilters
...ates are ran through after they are compiled . Postfilters can be either registe...
... postfilters are PHP functions that your templates are ran through after they ar...
...aded from the plugins directory by using the loadFilter() function or by setting...
... The postfilter above will make the compiled Smarty template index.tpl look like...
...) { return " ?php echo \" !-- Created by Smarty! -- \n\"; ? \n".$tpl_source; } /...
-
tips.obfuscating.email
...fuscating E-mail Addresses Do you ever wonder how your email address gets on so ...
...ail Addresses Do you ever wonder how your email address gets on so many spam mai...
...dresses Do you ever wonder how your email address gets on so many spam mailing l...
...dresses is from web pages. To help combat this problem, you can make your email ...
...mbat this problem, you can make your email address show up in scrambled javascri...
... Obfuscating E-mail Addresses Obfuscating E-mail Addresses obfuscating, e, mail,...
-
api.fetch
...index.tpl', $cache_id); // do something with $output here echo $output; ? Exampl...
...e template output Description string fetch ( string template ,   ...
...in the event that you want to compile different versions of the same template, s...
... 40 characters. This helps make the text easier to read in mail programs that do...
...marty = new Smarty; $smarty- setCaching(true); // set a separate cache_id for ea...
-
resources.extends
...an inheritance chain, its "don't save a compile file" property is superseeded by...
...trings are used, make sure they are properly (url or base64) encoded. Is an eval...
... define child/parent relationships for template inheritance from the PHP script....
... extends: resource is used to define child/parent relationships for template inh...
...tes from strings are used, make sure they are properly (url or base64) encoded. ...
...the PHP script ?php $smarty- display('extends:parent.tpl|child.tpl|grandchild.tp...
-
api.register.object
...tion. See also getRegisteredObject() , and unregisterObject() . Prev  Up Â...
... in the templates Description void registerObject ( string object_name ,...
...ou register/assign objects to templates, be sure that all properties and methods...
-
plugins.compiler.functions
...mpilation of the template. They are useful for injecting PHP code or time-sensit...
... Compiler Functions Compiler Functions compiler, functions Compiler Functions Pr...
...sensitive static content into the template. If there is both a compiler function...
... injecting PHP code or time-sensitive static content into the template. If there...
-
language.function.debug
... loaded from cache {debug} does show only the variables which assigned for the c...
...er 7. Built-in Functions  Next {debug} {debug} dumps the debug console...
...ime, this is only able to show the assigned variables; not the templates that ar...
...g} dumps the debug console to the page. This works regardless of the debug setti...
...ithin the template it does make sense to place the {debug} tag at the end of the...
... Chapter 7. Built-in Functions  Next {debug} {debug} dumps the deb...
-
installing.smarty.extended
...he same vars, etc., we can do that in one place. Lets create a new directory /ph...
...Chapter 2. Installation  Next Extended Setup This is a continuation of...
...slightly more flexible way to setup Smarty is to extend the class and initialize...
...hp/includes/guestbook/ and make a new file called setup.php . In our example env...
...arent::__construct(); $this- setTemplateDir('/web/www.example.com/guestbook/temp...
-
advanced.features.objects
...r block-function-plugins : They get the four parameters $params , $content , $sm...
...template are for presentation purposes only. It is very easy to inject applicati...
...ain methods or properties. However, a registered object cannot be looped over or...
...jects Smarty allows access to PHP objects through the templates. Note When you a...
...g in the template ( {foobar- meth2}...{/foobar- meth2} ) and the parameters to t...
-
language.function.insert
...a static link here, and we don't want this contents cached with the page. In com...
...mplate caching is enabled. They will be executed on every invocation of the temp...
...er 7. Built-in Functions  Next {insert} IMPORTANT NOTICE {insert} tags...
...he output will be assigned to script string No n/a The name of the php script th...
... must be included first to make it work. The path can be either absolute, or rel...
... Chapter 7. Built-in Functions  Next {insert} IMPORTANT NOTICE {in...
-
variable.direct.access.security
...This is a compile time option. If you change the setting you must make sure that...
...bits direct browser access to compiled or cached template files. Direct access s...
...hange the setting you must make sure that the templates get recompiled. Prev Â...
-
variable.merge.compiled.includes
.... $merge_compiled_includes does not have to be enabled for the inline merge. ?ph...
... by setting the inline option flag within the {include} tag. $merge_compiled_inc...
...g $merge_compiled_includes to TRUE Smarty will merge the compiled template code ...
...hange the setting you must make sure that the templates get recompiled. See also...
... using a many different sub-templates. Individual sub-templates can be merged by...