Smarty - the compiling PHP template engine

Smarty - the compiling PHP template engine

Monte Ohrt <monte at ohrt dot com>
Andrei Zmievski <andrei@php.net>

14-12-2005


Table of Contents
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
Variables loaded from config files
{$smarty} reserved variable
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
{capture}
{config_load}
{foreach},{foreachelse}
{if},{elseif},{else}
{include}
{include_php}
{insert}
{ldelim},{rdelim}
{literal}
{php}
{section},{sectionelse}
{strip}
8. Custom Functions
{assign}
{counter}
{cycle}
{debug}
{eval}
{fetch}
{html_checkboxes}
{html_image}
{html_options}
{html_radios}
{html_select_date}
{html_select_time}
{html_table}
{mailto}
{math}
{popup}
{popup_init}
{textformat}
9. Config Files
10. Debugging Console
III. Smarty For Programmers
11. Constants
SMARTY_DIR
SMARTY_CORE_DIR
12. Smarty Class Variables
$template_dir
$compile_dir
$config_dir
$plugins_dir
$debugging
$debug_tpl
$debugging_ctrl
$autoload_filters
$compile_check
$force_compile
$caching
$cache_dir
$cache_lifetime
$cache_handler_func
$cache_modified_check
$config_overwrite
$config_booleanize
$config_read_hidden
$config_fix_newlines
$default_template_handler_func
$php_handling
$security
$secure_dir
$security_settings
$trusted_dir
$left_delimiter
$right_delimiter
$compiler_class
$request_vars_order
$request_use_auto_globals
$error_reporting
$compile_id
$use_sub_dirs
$default_modifiers
$default_resource_type
13. Smarty Class Methods()
append() -- append an element to an assigned array
append_by_ref() -- append values by reference
assign() -- assign values to the templates
assign_by_ref() -- assign values by reference
clear_all_assign() -- clears the values of all assigned variables
clear_all_cache() -- clears the entire template cache
clear_assign() -- clears the value of an assigned variable
clear_cache() -- clears the cache for a specific template
clear_compiled_tpl() -- clears the compiled version of the specified template resource
clear_config() -- clears assigned config variables
config_load() --  loads config file data and assigns it to the template
display() -- displays the template
fetch() -- returns the template output
get_config_vars() -- returns the given loaded config variable value
get_registered_object() -- returns a reference to a registered object
get_template_vars() -- returns assigned variable value(s)
is_cached() -- returns true if there is a valid cache for this template
load_filter() -- load a filter plugin
register_block() -- dynamically register block functions plugins
register_compiler_function() -- dynamically register a compiler function plugin
register_function() -- dynamically register template function plugins
register_modifier() -- dynamically register modifier plugin
register_object() -- register an object for use in the templates
register_outputfilter() -- dynamically register outputfilters
register_postfilter() -- dynamically register postfilters
register_prefilter() -- dynamically register prefilters
register_resource() -- dynamically register resources
trigger_error() -- output an error message
template_exists() -- checks whether the specified template exists
unregister_block() -- dynamically unregister block function plugins
unregister_compiler_function() -- dynamically unregister a compiler function
unregister_function -- dynamically unregister template function plugin
unregister_modifier() -- dynamically unregister modifier plugin
unregister_object() -- dynamically unregister an object
unregister_outputfilter() -- dynamically unregister an output filter
unregister_postfilter() -- dynamically unregister a postfilter
unregister_prefilter() -- dynamically unregister a prefilter
unregister_resource() -- dynamically unregister a resource plugin
14. Caching
Setting Up Caching
Multiple Caches Per Page
Cache Groups
Controlling Cacheability of Plugins' Output
15. Advanced Features
Objects
Prefilters
Postfilters
Output Filters
Cache Handler Function
Resources
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
© Copyright 2003-2014 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.