-
advanced.features.template.settings
...Chapter 17. Advanced Features  Next Changing settings by template Norm...
...= $smarty- createTemplate('index.tpl); $tpl- cache_lifetime = 600; //or $tpl- se...
... by template Normally you configure the Smarty settings by modifying the Smarty ...
-
preface
.... Smarty also has security features that can further enforce restrictions on tem...
...se goals: clean separation of presentation from application code PHP backend, Sm...
...liment PHP, not replace it fast development/deployment for programmers and desig...
...these goals: clean separation of presentation from application code PHP backend,...
-
advanced.features.outputfilters
...Chapter 17. Advanced Features  Next Output Filters When the template i...
...ction to return the result of the processing. Example 17.13. Using a templ...
...email"); $smarty- display("index.tpl'); // now any occurrence of an email addres...
...output can be sent through one or more output filters. This differs from postfil...
-
what.is.smarty
...les only. Some of Smarty's features: It is extremely fast. It is efficient since...
...tes and uses a combination of HTML tags and template tags to format the presenta...
... features: It is extremely fast. It is efficient since the PHP parser does the d...
...e way to separate application logic and content from its presentation. This is b...
-
advanced.features.postfilters
...Chapter 17. Advanced Features  Next Postfilters Template postfilters a...
...ction to return the result of the processing. Example 17.12. Using a templ...
...mment'); $smarty- display('index.tpl'); ? The postfilter above will make the com...
... postfilters are PHP functions that your templates are ran through after they ar...
-
resources.custom
...Chapter 17. Advanced Features ...
...tion times can be accessed faster than loading the comple template source. * @pa...
...pt $smarty- display("mysql:index.tpl"); ? And from within Smarty template: {incl...
...ting resource plugin functions and registering them with Smarty. See resource pl...
-
index
...ate Resources 17. Advanced Features Security Changing settings by template Templ...
...oup, Inc. 2011-11-29 Table of Contents Preface I. Getting Started 1. What is Sma...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
...iling PHP template engine Monte Ohrt monte at ohrt dot com Uwe Tews uwe dot tews...
-
advanced.features.objects
...Chapter 17. Advanced Features  Next Objects Smarty allows access to PH...
...the Best Practices section of the Smarty website. There are two ways to access t...
...$myobj); $smarty- display('index.tpl'); ? And here's how to access your objects ...
...template are for presentation purposes only. It is very easy to inject applicati...
-
advanced.features.prefilters
...Chapter 17. Advanced Features  Next Prefilters Template prefilters are...
...ments'); $smarty- display('index.tpl'); ? See also registerFilter() , postfilter...
...e prefilters are PHP functions that your templates are ran through before they a...
-
advanced.features.streams
...Chapter 17. Advanced Features  Next Streams You can also use streams t...
-
installing.smarty.basic
...n the /libs/ sub directory of the distribution. These are .php files that you SH...
...com/ guestbook/ templates/ index.tpl templates_c/ configs/ cache/ htdocs/ index....
... Basic Installation Basic Installation basic, installation Basic Installation Pr...
-
api.get.tags
... function returns an array of tagname/attribute pairs for all tags used by the t...
...= $smarty- createTemplate('index.tpl'); // get tags $tags = $smarty- getTags($tp...
... used by template Description string getTags ( object template ); This f...
-
language.function.append
...rrays during the execution of a template . Note Assignment of variables in-templ...
...a The value being assigned index string No n/a The index for the new array eleme...
...er 7. Built-in Functions  Next {append} {append} is used for creating ...
-
variable.default.resource.type
...ing that $smarty- display('index.tpl') and $smarty- display('file:index.tpl') ar...
...ers Home  $default_config_handler_func ...
-
language.variables.smarty
...t variables. The full list of them follows. Request variables The request variab...
...ET) http://www.example.com/index.php?page=foo *} {$smarty.get.page} {* display t...
...sed to access several environment and request variables. The full list of them f...
-
api.template.exists
...php // set the filename eg index.inc.tpl $mid_template = $_GET['page'].'.inc.tpl...
...d template exists Description bool templateExists ( string template ); I...
-
smarty.for.designers
...r Template Designers Table of Contents 3. Basic Syntax Comments Variables Functi...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
...mplate Designers Table of Contents 3. Basic Syntax Comments Variables Functions ...
-
language.function.strip
...he rendered HTML (browser "features"), so you must run all your tags together in...
... returns affect the output of the rendered HTML (browser "features"), so you mus...
...er 7. Built-in Functions  Next {strip} Many times web designers run in...
-
language.syntax.variables
...-- display the 5th element of a zero-indexed array {$foo.bar} -- display the "ba...
...ou can reference arrays by index numerically or non-numerically. Also reference ...
...he $dollar sign. They can contain numbers, letters and underscores, much like a ...
-
api.assign.by.ref
...Note With the introduction of PHP5, assignByRef() is not necessary for most inte...
...ul if you want a PHP array index value to be affected by its reassignment from a...
...lues by reference Description void assignByRef ( string varname ,  Â...
-
language.variable.scopes
...ign variables to the scope of the main Smarty object, data objects created with ...
...= $smarty- createTemplate('index.tpl'); $tpl- assign('bar','bar-template'); // a...
...ate objects you have full control which variables can be seen by a template. Exa...
-
api.create.template
...e_id variable once instead of passing this to each call to this function. It is ...
...= $smarty- createTemplate('index.tpl'); // assign variable to template scope $tp...
...a template object Description Smarty_Internal_Template createTemplate ( stri...
-
api.append.by.ref
...Note With the introduction of PHP5, appendByRef() is not necessary for most inte...
...ul if you want a PHP array index value to be affected by its reassignment from a...
...lues by reference Description void appendByRef ( string varname ,  Â...
-
caching
...er 15. Caching Table of Contents Setting Up Caching Multiple Caches Per Pa...
...URRENT); $smarty- display('index.tpl'); ? With caching enabled, the function cal...
... 15. Caching Table of Contents Setting Up Caching Multiple Caches Per Page C...
-
advanced.features.template.inheritance
...Chapter 17. Advanced Features  Next Template Inheritance Inheritance b...
...ritance brings the concept of Object Oriented Programming to templates, allowing...
...ce Inheritance brings the concept of Object Oriented Programming to templates, a...
-
language.function.eval
...me escapement and security features just as if they were templates. Evaluated va...
...sign attribute, the output of the {eval} function will be assigned to this templ...
...pter 8. Custom Functions  Next {eval} {eval} is used to evaluate a var...
-
api.is.cached
... if $caching is set to one of Smarty::CACHING_LIFETIME_CURRENT or Smarty::CACHIN...
...T); if(!$smarty- isCached('index.tpl')) { // do database calls, assign vars here...
...for this template Description bool isCached ( string template ,   ...
-
language.builtin.functions
... Built-in Functions Table of Contents {$var=...} {append} {assign} {block} {cal...
...} {foreach},{foreachelse} @index @iteration @first @last @show @total {break} {c...
...er 7. Built-in Functions Chapter 7. Built-in Functions chapter, 7, b...
-
advanced.features
...Chapter 17. Advanced Features Chapter 17. Advanced Features chapter,...
... Advanced Features Table of Contents Security Changing settings by template Te...
...dvanced Features Table of Contents Security Changing settings by template Templa...
-
language.function.html.table
...nction that dumps an array of data into an HTML table . Attribute Name Type Requ...
...dd"') ); $smarty- display('index.tpl'); ? The variables assigned from php could ...
...pter 8. Custom Functions  Next {html_table} {html_table} is a custom f...
-
language.function.foreach
...ed for looping over arrays of data. {foreach} has a simpler and cleaner syntax t...
... {foreach} properties are @index , @iteration , @first , @last , @show , @total ...
...er 7. Built-in Functions  Next {foreach},{foreachelse} {foreach} is us...
-
caching.custom
...ng to achieve at least one of the following goals: replace the slow filesystem b...
...e the slow filesystem by a faster storage engine, centralize the cache to be acc...
...L, * PRIMARY KEY (`id`), * INDEX(`name`), * INDEX(`cache_id`), * INDEX(`compile_...
... Custom Cache Implementation Custom Cache Implementation custom, cache, implemen...
-
troubleshooting
.... Troubleshooting Table of Contents Smarty/PHP errors Smarty/PHP errors Smart...
...rrors Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah...
...Troubleshooting Table of Contents Smarty/PHP errors Smarty/PHP errors Smarty ca...
-
advanced.features.static.classes
...Chapter 17. Advanced Features  Next Static Classes You can directly ac...
...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...
-
smarty.for.programmers
...ate Resources 17. Advanced Features Security Changing settings by template Templ...
...arty For Programmers Table of Contents 11. Charset Encoding Charset Encoding 12....
... For Programmers Table of Contents 11. Charset Encoding Charset Encoding 12. Con...
-
plugins.resources
...are meant as a generic way of providing template sources or PHP script component...
...tion times can be accessed faster than loading the comple template source. * @pa...
...pt $smarty- display("mysql:index.tpl"); ? And from within Smarty template: {incl...
... sources or PHP script components to Smarty. Some examples of resources: databas...
-
language.modifier.strip
...f you want to strip blocks of template text, use the built-in {strip} function. ...
... one."); $smarty- display('index.tpl'); ? Where template is: {$articleTitle} {$a...
...the built-in {strip} function. Example 5.19. strip ?php $smarty- assign('a...
-
caching.cacheable
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
...); if (!$smarty- isCached('index.tpl')) { // fetch $obj from db and assign... $s...
... Controlling Cacheability of Output Controlling Cacheability of Output controlli...
-
caching.groups
...as you like. You can think of cache groups like a directory hierarchy. For insta...
...structure like themes/blue/index.tpl and you want to be able to clear all the ca...
...ouping works left-to-right ONLY. You will need to group your templates under a s...
-
language.function.if
...atements, with a few added features for the template engine. Every {if} must be ...
...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...
-
language.variables
...r 4. Variables Table of Contents Variables assigned from PHP Associative a...
...email' = 'zaphod@slartibartfast.example.com', 'phone' = array('home' = '555-444-...
...P Associative arrays Array indexes Objects Variable scopes Variables loaded from...
...4. Variables Table of Contents Variables assigned from PHP Associative array...
-
api.fetch
...he template output instead of displaying it. Supply a valid template resource ty...
... $output = $smarty- fetch('index.tpl', $cache_id); // do something with $output ...
...e template output Description string fetch ( string template ,   ...
-
api.display
...This displays the contents of a template. To return the contents of a template i...
...ist if(!$smarty- isCached('index.tpl')) { // dummy up some data $address = '245 ...
...lays the template Description void display ( string template ,   ...
-
language.function.assign
...ables during the execution of a template . Note Assignment of variables in-templ...
...ole_page = $smarty- fetch('index.tpl'); // this will output 'smarty' as the temp...
...er 7. Built-in Functions  Next {assign} {assign} is used for assigning...
-
caching.multiple.caches
...id . For each unique value of $my_cache_id , a separate cache will be generated ...
...ay that a call to display('index.tpl') may have several different output content...
... several different output contents depending on some condition, and you want sep...
-
plugins.compiler.functions
...ed only during compilation of the template. They are useful for injecting PHP co...
...hing like this: ?php echo 'index.tpl compiled at 2002-02-20 20:02'; ? See also r...
... Compiler Functions Compiler Functions compiler, functions Compiler Functions Pr...
-
installing.smarty.extended
...tup This is a continuation of the basic installation , please read that first! A...
...; } } ? Now lets alter the index.php file to use setup.php : Example 2.11.Â...
...Chapter 2. Installation  Next Extended Setup This is a continuation of...
-
tips.componentized.templates
...sign'], $ticker_info); } ? index.tpl {load_ticker symbol='SMARTY' assign='ticker...
... Componentized Templates Componentized Templates componentized, templates Compon...
-
api.register.resource
...h Smarty. Pass in the name of the Resource and the object extending Smarty_Resou...
...marty- display('c:/path/to/index.tpl'); Note Prior to Smarty 3.1 registerResourc...
...egister resources Description void registerResource ( string name ,  ...
-
api.load.filter
...oload_filters and advanced features . Prev  Up  Next isCached() Home...
...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 ,   Â...
-
api.clear.compiled.tpl
...lears the compiled version of the specified template resource Description voidÂ...
...ty- clearCompiledTemplate('index.tpl'); // clear entire compile directory $smart...
... clears the compiled version of the specified template resource Description voi...
-
language.function.while
...atements, with a few added features for the template engine. Every {while} must ...
...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...
-
language.function.section
...equentially indexed arrays of data , unlike {foreach} which is used to loop over...
... looping over sequentially indexed arrays of data , unlike {foreach} which is us...
... {section},{sectionelse} {section},{sectionelse} , ldelim, section, rdelim, ldel...
-
resources
... 16. Resources Table of Contents File Template Resources Templates from $t...
...dir ?php $smarty- display('index.tpl'); $smarty- display('file:index.tpl'); // s...
...16. Resources Table of Contents File Template Resources Templates from $templ...
-
api.create.data
... variables assigned to any of the objects in it's parent chain. Data objects are...
...= $smarty- createTemplate('index.tpl',$data); // display the template $tpl- disp...
...tes a data object Description string createData ( object parent ); strin...
-
api.clear.cache
...plate $smarty- clearCache('index.tpl'); // clear the cache for a particular cach...
...specific template Description void clearCache ( string template ,  Â...