Smarty content
home Info sitemap


Do you want outsource your project? PHP or Java , JSF 2, Richfaces 4, MySql and other technologies. Just send mail to info@developer.am.

Tutorial from officaial smarty web site.
Preface
I. Getting Started
1. What is Smarty?
2. Installation
Requirements
Basic Installation
Extended Setup
II. Smarty For Template Designers
3. Basic Syntax
Comments
Variables
Functions
Attributes
Embedding Vars in Double Quotes
Math
Escaping Smarty Parsing
4. Variables
Variables assigned from PHP
Associative arrays
Array indexes
Objects
Variable scopes
Variables loaded from config files
{$smarty} reserved variable
Request variables
{$smarty.now}
{$smarty.const}
{$smarty.capture}
{$smarty.config}
{$smarty.section}
{$smarty.template}
{$smarty.current_dir}
{$smarty.version}
{$smarty.block.child}
{$smarty.block.parent}
{$smarty.ldelim}, {$smarty.rdelim}
5. Variable Modifiers
capitalize
cat
count_characters
count_paragraphs
count_sentences
count_words
date_format
default
escape
indent
lower
nl2br
regex_replace
replace
spacify
string_format
strip
strip_tags
truncate
upper
wordwrap
6. Combining Modifiers
7. Built-in Functions
{$var=...}
{append}
{assign}
{block}
{call}
{capture}
{config_load}
{debug}
{extends}
{for}
{foreach},{foreachelse}
@index
@iteration
@first
@last
@show
@total
{function}
{if},{elseif},{else}
{include}
{include_php}
{insert}
{ldelim},{rdelim}
{literal}
{nocache}
{php}
{section},{sectionelse}
.index
.index_prev
.index_next
.iteration
.first
.last
.rownum
.loop
.show
.total
{strip}
{while}
8. Custom Functions
{counter}
{cycle}
{eval}
{fetch}
{html_checkboxes}
{html_image}
{html_options}
{html_radios}
{html_select_date}
{html_select_time}
{html_table}
{mailto}
{math}
{textformat}
9. Config Files
10. Debugging Console
III. Smarty For Programmers
11. Constants
SMARTY_DIR
12. Smarty Class Variables
$auto_literal
$autoload_filters
$cache_dir
$cache_handler_func
$cache_id
$cache_lifetime
$cache_modified_check
$caching
$compile_check
$compile_dir
$compile_id
$compiler_class
$config_booleanize
$config_dir
$config_overwrite
$config_read_hidden
$debug_tpl
$debugging
$debugging_ctrl
$default_modifiers
$default_resource_type
$default_template_handler_func
$error_reporting
$force_compile
$left_delimiter
$php_handling
$plugins_dir
$right_delimiter
$template_dir
$trusted_dir
$use_sub_dirs
13. Smarty Class Methods()
append() — append an element to an assigned array
appendByRef() — append values by reference
assign() — assign variables/objects to the templates
assignByRef() — assign values by reference
clearAllAssign() — clears the values of all assigned variables
clearAllCache() — clears the entire template cache
clearAssign() — clears the value of an assigned variable
clearCache() — clears the cache for a specific template
clearCompiledTemplate() — clears the compiled version of the specified template resource
clearConfig() — clears assigned config variables
compileAllConfig() — compiles all known config files
compileAllTemplates() — compiles all known templates
configLoad() — loads config file data and assigns it to the template
createData() — creates a data object
createTemplate() — returns a template object
disableSecurity() — disables template security
display() — displays the template
enableSecurity() — enables template security
fetch() — returns the template output
getConfigVars() — returns the given loaded config variable value
getRegisteredObject() — returns a reference to a registered object
getTags() — return tags used by template
getTemplateVars() — returns assigned variable value(s)
isCached() — returns true if there is a valid cache for this template
loadFilter() — load a filter plugin
registerFilter() — dynamically register filters
registerPlugin() — dynamically register plugins
registerObject() — register an object for use in the templates
registerResource() — dynamically register resources
templateExists() — checks whether the specified template exists
unregisterFilter() — dynamically unregister a filter
unregisterPlugin — dynamically unregister plugins
unregisterObject() — dynamically unregister an object
unregisterResource() — dynamically unregister a resource plugin
testInstall() — checks Smarty installation
14. Caching
Setting Up Caching
Multiple Caches Per Page
Cache Groups
Controlling Cacheability of Output
Cacheability of Template Section
Cacheability of Tags
Cacheability of Variables
Cacheability of Plugins
15. Advanced Features
Security
Changing settings by template
Template Inheritance
Streams
Objects
Static Classes
Prefilters
Postfilters
Output Filters
Cache Handler Function
Resources
Templates from $template_dir
Templates from any directory
Templates from strings
Template inheritance defined by PHP script
Templates from other sources
Default template handler function
16. Extending Smarty With Plugins
How Plugins Work
Naming Conventions
Writing Plugins
Template Functions
Modifiers
Block Functions
Compiler Functions
Prefilters/Postfilters
Output Filters
Resources
Inserts
IV. Appendixes
17. Troubleshooting
Smarty/PHP errors
18. Tips & Tricks
Blank Variable Handling
Default Variable Handling
Passing variable title to header template
Dates
WAP/WML
Componentized Templates
Obfuscating E-mail Addresses
19. Resources
20. BUGS

PHP Tutorial


Learn PHP
Learn ZEND
Learn Smarty