-
language.syntax.variables
...ence object properties and methods. Config file variables are an exception to th...
...variables are an exception to the $dollar syntax and are instead referenced with...
... find your template syntax getting too complex, it may be a good idea to move th...
... presentation. If you find your template syntax getting too complex, it may be a...
... the 5th element of a zero-indexed array {$foo.bar} -- display the "bar" key val...
.... You can reference arrays by index numerically or non-numerically. Also referen...
-
preface
...d designers quick and easy to maintain syntax easy to understand, no PHP knowled...
...tegration Sometimes Smarty gets compared to Model-View-Controller (MVC) framewor...
...esentation. Smarty focuses your templates on presentation and less on "code". Th...
...ices section of the Smarty website. How does it work? Under the hood, Smarty "co...
... design was largely driven by these goals: clean separation of presentation from...
-
advanced.features.static.classes
...ign var=foo value=myclass::method()} --- method result {assign var=foo value=myc...
...in PHP. Note Direct access to PHP classes is not recommended. This ties the unde...
...HP classes/objects. Use at your own discretion. See the Best Practices section o...
...ices section of the Smarty website. Example 17.10. static class access syn...
-
advanced.features.objects
...re that all properties and methods accessed from the template are for presentati...
...jects Smarty allows access to PHP objects through the templates. Note When you a...
... same way custom functions get them. An associative array is passed as the first...
...oose will be determined by your needs, but use the first method whenever possibl...
...ices section of the Smarty website. There are two ways to access them. One way i...
... choose will be determined by your needs, but use the first method whenever poss...
-
variable.cache.lifetime
...e caching a more efficient method is to set $caching = Smarty::CACHING_OFF). If ...
...SAVED) for $cache_lifetime to have any purpose. A $cache_lifetime value of -1 wi...
...ifetime, you could do this by setting $caching = Smarty::CACHING_LIFETIME_SAVED,...
-
api.unregister.plugin
...ter 14. Smarty Class Methods  Next Name unregisterPlugin — dyna...
...'t want template designers to have access to function plugin "date_now" $smarty-...
...ously have been registered by registerPlugin() , It uses the following parameter...
-
api.create.template
...ter 14. Smarty Class Methods  Next Name createTemplate() — retu...
...ce instead of passing this to each call to this function. It is used in the even...
...e pairs of variables which get assigned to the object. Example 14.18. crea...
...hich later can be rendered by the display or fetch method. It uses the following...
-
api.append.by.ref
...ter 14. Smarty Class Methods  Next Name appendByRef() — append ...
... merge ); This is used to append() values to the templates by reference. Tec...
...so append() , assign() and getTemplateVars() . Prev  Up  Next append()Â...
... you merge two numerically indexed arrays, they may overwrite each other or resu...
... appendByRef() appendByRef() appendbyref, appendByRef() Prev  Chapter 14....
-
caching
...Cacheability of Plugins Custom Cache Implementation Caching is used to speed up ...
...ignments here. $contents = get_database_contents(); $smarty- assign($contents); ...
...splaying the front page of your website that does not change its content very of...
...ing the front page of your website that does not change its content very often, ...
...ll to display() or fetch() by saving its output to a file. If a cached version o...
-
api.set.template.dir
...ter 14. Smarty Class Methods  Next Name setTemplateDir() — set ...
...ir() — set the directories where templates are stored Description Smarty...
...ir chain var_dump($smarty- getTemplateDir()); // set multiple directorÃes whe...
-
api.register.default.plugin.handler
...ter 14. Smarty Class Methods  Next Name registerDefaultPluginHandler()...
... $object being a reference to an object and $method being a string containing th...
... register a function which gets called on undefined tags Description void re...
...der it tries to resolve it by calling the registered default plugin handler. The...
-
bugs
...on of Smarty, or check the website. Prev  Up  Chapter 22. Resource...
-
caching.custom
... * @note implementing this method is optional. Only implement it if modification...
... Custom Cache Implementation Custom Cache Implementation custom, cache, implemen...
...l Resource failed: ' . $e- getMessage()); } $this- fetch = $this- db- prepare('S...
...ead, write, clear calls to your implementation. This API allows you to store whe...
...ty3 replaced this callback by the Smarty_CacheResource module. With a custom cac...
-
api.unregister.filter
...ter 14. Smarty Class Methods  Next Name unregisterFilter() — dy...
...y callback ); Use this to dynamically unregister filters. It uses the follow...
-
advanced.features.outputfilters
... by using the loadFilter() method or by setting the $autoload_filters variable. ...
...ates before they are saved to the disk, whereas output filters operate on the te...
...filter ?php // put this in your application function protect_email($tpl_output, ...
...from the plugins directory by using the loadFilter() method or by setting the $a...
-
plugins.resources
... * @note implementing this method is optional. Only implement it if modification...
...s or PHP script components to Smarty. Some examples of resources: databases, LDA...
...ss via $_template- smarty- getTemplateVars() . These Resources simply echo their...
...ource.foobarxyz.php within your $plugins_dir , or registered on runtime with reg...
...le to access that resource by prepending its name to the template you're address...
-
what.is.smarty
...cilitates a manageable way to separate application logic and content from its pr...
...y? Prev  Part I. Getting Started  Next Chapter 1. What is Sm...
...s logic in the template is your own doing. Also, if you desire no logic in your ...
...hey are passed into Smarty by the application. Then the template designer edits ...
-
api.assign
...ter 14. Smarty Class Methods  Next Name assign() — assign varia...
... assign variables/objects to the templates Description void assign ( mixed...
...ty- assign('contact', $db- getRow($sql)); ? These are accessed in the template w...
...ices section of the Smarty website. Example 14.6. assign() ?php // passing...
...d {section} See also assignByRef() , getTemplateVars() , clearAssign() , append(...
-
api.add.plugins.dir
...ter 14. Smarty Class Methods  Next Name addPluginsDir() — add a...
...sDir() — add a directory to the list of directories where plugins are sto...
...ir chain var_dump($smarty- getPluginsDir()); // chaining of method calls $smarty...
-
api.set.cache.dir
...ter 14. Smarty Class Methods  Next Name setCacheDir() — set the...
...ir() — set the directory where the rendered template's output is stored D...
...Dir('./cache'); ? See also getCacheDir() and $cache_dir . Prev  Up  Next...
-
tips.obfuscating.email
...} /div Technical Note This method isn't 100% foolproof. A spammer could conceiva...
...dresses is from web pages. To help combat this problem, you can make your email ...
...der how your email address gets on so many spam mailing lists? One way spammers ...
...ses Do you ever wonder how your email address gets on so many spam mailing lists...
-
api.register.filter
...ter 14. Smarty Class Methods  Next Name registerFilter() — dyna...
...d callback ); Use this to dynamically register filters to operate on a templ...
... template source before it gets compiled. See template prefilters for more infor...
-
language.function.assign
...te See also the short-form method of assigning template vars. Attributes: Attrib...
...lacing application logic into the presentation that may be better handled in PHP...
...bles from a php script use getTemplateVars() . Here's the template that creates ...
...ter handled in PHP. Use at your own discretion. Note See also the short-form met...
...tree. The variable is seen by all templates using the same root tree. {assign va...
-
resources.custom
... * @note implementing this method is optional. Only implement it if modification...
... Custom Template Resources Custom Template Resources custom, template, resources...
...l Resource failed: ' . $e- getMessage()); } $this- fetch = $this- db- prepare('S...
...s, files, etc. You do this by writing resource plugin functions and registering ...
-
api.register.object
...ter 14. Smarty Class Methods  Next Name registerObject() — regi...
...ou register/assign objects to templates, be sure that all properties and methods...
...more information. See also getRegisteredObject() , and unregisterObject() . Prev...
...ices section of the Smarty website. See the objects section for more information...
-
language.config.variables
...e demonstrating the #hash# method: {config_load file='foo.conf'} html title {#pa...
... is useful for embedding into quoted attribute values, or accessing variable val...
...config file - foo.conf : pageTitle = "This is mine" bodyBgColor = '#eeeeee' tabl...
...onfig files are referenced by enclosing them within #hash_marks# , or with the s...
-
api.set.config.dir
...ter 14. Smarty Class Methods  Next Name setConfigDir() — set th...
...ir() — set the directories where config files are stored Description Smar...
...ir chain var_dump($smarty- getConfigDir()); // set multiple directorÃes where...
-
api.append
...ter 14. Smarty Class Methods  Next Name append() — append an el...
...— append an element to an assigned array Description void append ( mi...
...pendByRef() , assign() and getTemplateVars() Prev  Up  Next addTemplateD...
... you merge two numerically indexed arrays, they may overwrite each other or resu...
...raska')); ? See also appendByRef() , assign() and getTemplateVars() Prev  Up...
-
api.add.config.dir
...ter 14. Smarty Class Methods  Next Name addConfigDir() — add a ...
...gDir() — add a directory to the list of directories where config files ar...
...ir chain var_dump($smarty- getConfigDir()); // chaining of method calls $smarty-...
-
language.function.include
...t of {include} is assigned to, instead of being displayed. Similar to {assign} ....
...ed template will be cached independent of the global cahing setting. {include 's...
...d in the included template by using the scope attribute at the {include} stateme...
-
language.function.section
...ke {foreach} which is used to loop over a single associative array . Every {sect...
...y- assign('contacts', $db- getAll($sql)); ? The template to output the database ...
... looping over sequentially indexed arrays of data , unlike {foreach} which is us...
...l determine the loop count by the array size, or you can pass an integer to spec...
-
api.add.template.dir
...ter 14. Smarty Class Methods  Next Name addTemplateDir() — add ...
...eDir() — add a directory to the list of directories where templates are s...
...ir chain var_dump($smarty- getTemplateDir()); // chaining of method calls $smart...
-
api.set.compile.dir
...ter 14. Smarty Class Methods  Next Name setCompileDir() — set t...
...ir() — set the directory where compiled templates are stored Description ...
...Dir('./cache'); ? See also getCompileDir() and $compile_dir . Prev  Up  ...
-
api.register.plugin
...ter 14. Smarty Class Methods  Next Name registerPlugin() — dyna...
... $object being a reference to an object and $method being a string containing th...
...ions or methods defined in your script as plugin. It uses the following paramete...
-
api.set.plugins.dir
...ter 14. Smarty Class Methods  Next Name setPluginsDir() — set t...
...ir() — set the directories where plugins are stored Description SmartyÂ...
...ir chain var_dump($smarty- getPluginsDir()); // set multiple directorÃes wher...