当前位置: 主页 > 程序设计 > PHP > PHP基础 > Smarty3 在线手册

Smarty3 在线手册

时间:2013-10-30 16:14 点击:12914次 字体:[ ]



Table of Contents

I. Getting Started
1. What is Smarty?
2. Installation
Basic Installation
Extended Setup
II. Smarty For Template Designers
3. Basic Syntax
Embedding Vars in Double Quotes
Escaping Smarty Parsing
4. Variables
Variables assigned from PHP
Associative arrays
Array indexes
Variable scopes
Variables loaded from config files
{$smarty} reserved variable
Request variables
{$smarty.ldelim}, {$smarty.rdelim}
5. Variable Modifiers
6. Combining Modifiers
7. Built-in Functions
8. Custom Functions
9. Config Files
10. Debugging Console
III. Smarty For Programmers
11. Constants
12. Smarty Class Variables
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 Plugins' Output
15. Advanced Features
Changing settings by template
Template Inheritance
Static Classes
Output Filters
Cache Handler Function
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
Block Functions
Compiler Functions
Output Filters
IV. Appendixes
17. Troubleshooting
Smarty/PHP errors
18. Tips & Tricks
Blank Variable Handling
Default Variable Handling
Passing variable title to header template
Componentized Templates
Obfuscating E-mail Addresses
19. Resources
20. BUGS

List of Examples

2.1. Required Smarty library files
2.2. Set SMARTY_DIR constant manually
2.3. Supply absolute path to library file
2.4. Add the library path to the php.ini file
2.5. Appending the include path in a php script with ini_set()
2.6. What the file structure looks like
2.7. Permissions and making directories writable
2.8. /web/www.example.com/guestbook/templates/index.tpl
2.9. Editing /web/www.example.com/docs/guestbook/index.php
2.10. /php/includes/guestbook/setup.php
2.11. /web/www.example.com/guestbook/htdocs/index.php
3.1. Comments within a template
3.2. Variables
3.3. function syntax
3.4. function attribute syntax
3.5. Syntax examples
3.6. Examples
3.7. math examples
3.8. Using the auto-literal feature
3.9. changing delimiters example
4.1. Example variables
4.2. Assigned variables
4.3. Accessing associative array variables
4.4. Accessing arrays by index
4.5. Accessing object properties
4.6. Variable scope examples
4.7. config variables
4.8. Displaying request variables
5.1. Modifier examples
5.2. capitalize
5.3. cat
5.4. count_characters
5.5. count_paragraphs
5.6. count_sentences
5.7. count_words
5.8. date_format
5.9. default
5.10. escape
5.11. Other examples
5.12. indent
5.13. lower
5.14. nl2br
5.15. regex_replace
5.16. replace
5.17. spacify
5.18. string_format
5.19. strip
5.20. strip_tags
5.21. truncate
5.22. upper
5.23. wordwrap
6.1. combining modifiers
7.1. Simple assignment
7.2. Assignment with math
7.3. Assignment of an array element
7.4. Assignment of an multidimensional array element
7.5. Appending an array
7.6. Assigment in the scope of calling template
7.7. {append}
7.8. {assign}
7.9. {assign} as a nocache variable
7.10. {assign} with some maths
7.11. {assign} in the scope of calling template
7.12. {assign} a variable to current scope tree
7.13. {assign} a global variable
7.14. Accessing {assign} variables from a PHP script
7.15. Simple {block} example
7.16. Prepend {block} example
7.17. Append {block} example
7.18. {$smarty.block.child} example
7.19. {$smarty.block.parent} example
7.20. Calling a recursive menu example
7.21. {capture} with the name attribute
7.22. {capture} into a template variable
7.23. {capture} into a template array variable
7.24. {config_load}
7.25. function {config_load} with section
7.26. Simple {extends} example
7.27. A simple {for} loop
7.28. Using the max attribute
7.29. Excution of {forelse}
7.30. A simple {foreach} loop
7.31. Demonstrates the an additional key variable
7.32. {foreach} with nested item and key
7.33. Database example with {foreachelse}
7.34. index example
7.35. iteration example: is div by
7.36. iteration example: is even/odd by
7.37. first property example
7.38. last property example
7.39. show property example
7.40. total property example
7.41. Recursive menu {function} example
7.42. {if} statements
7.43. {if} with more examples
7.44. Simple {include} example
7.45. {include} passing variables
7.46. {include} using parent scope
7.47. {include} with disabled caching
7.48. {include} with individual cache lifetime
7.49. {include} with forced caching
7.50. {include} and assign to variable
7.51. Various {include} resource examples
7.52. function {include_php}
7.53. function {insert}
7.54. {ldelim}, {rdelim}
7.55. Another Javascript example
7.56. {literal} tags
7.57. Preventing a template section from being cached
7.58. php code within {php} tags
7.59. {php} tags with global and assigning a variable
7.60. Looping a simple array with {section}
7.61. {section} without an assigned array
7.62. Naming a {section}
7.63. Looping an associative array with {section}
7.64. {section} demonstrating the loop variable
7.65. Nested {section}'s
7.66. Database example with a {sectionelse}
7.67. {section} index property
7.68. index, index_next and index_prev properties
7.69. A section's iteration property
7.70. {section} property first and last
7.71. {section} property loop
7.72. show property
7.73. total property example
7.74. {strip} tags
7.75. {while} loop
8.1. {counter}
8.2. {cycle}
8.3. {eval}
8.4. Another {eval} example
8.5. {fetch} examples
8.6. {html_checkboxes}
8.7. Database example (eg PEAR or ADODB):
8.8. {html_image} example
8.9. Associative array with the options attribute
8.10. Dropdown with seperate arrays for values and ouptut
8.11. Database example (eg ADODB or PEAR)
8.12. Dropdown's with <optgroup>
8.13. {html_radios} first example
8.14. {html_radios} second example
8.15. {html_radios} - Database example (eg PEAR or ADODB):
8.16. {html_select_date}
8.17. {html_select_date} second example
8.18. {html_select_time}
8.19. {html_table}
8.20. {mailto} example lines followed by the result
8.21. {math}
8.22. {textformat}
9.1. Example of config file syntax
12.1. Appending a local plugin dir
12.2. Multiple $plugins_dir
12.3. $debugging_ctrl on localhost
12.4. Array of config #variables#
12.5. $compile_id in a virtual host environment
13.1. append
13.2. appendByRef
13.3. assign()
13.4. assignByRef()
13.5. clearAllAssign()
13.6. clearAllCache
13.7. clearAssign()
13.8. clearCache()
13.9. clearCompiledTemplate()
13.10. clearConfig()
13.11. compileAllTemplates()
13.12. compileAllTemplates()
13.13. configLoad()
13.14. createData()
13.15. createTemplate()
13.16. display()
13.17. Other display() template resource examples
13.18. fetch()
13.19. Using fetch() to send an email
13.20. getConfigVars()
13.21. getRegisteredObject()
13.22. getTags()
13.23. getTemplateVars
13.24. isCached()
13.25. isCached() with multiple-cache template
13.26. Loading filter plugins
13.27. register a function plugin
13.28. register block function plugin
13.29. register modifier plugin
13.30. registerResource()
13.31. templateExists()
13.32. unregister function plugin
13.33. unregisterResource()
13.34. testInstall()
14.1. Enabling caching
14.2. Setting $cache_lifetime per cache
14.3. Enabling $compile_check
14.4. Using is_cached()
14.5. Clearing the cache
14.6. Passing a $cache_id to display()
14.7. Passing a cache_id to is_cached()
14.8. Clearing all caches for a particular $cache_id
14.9. $cache_id groups
14.10. Preventing a plugin's output from being cached
14.11. Preventing a whole passage of a template from being cached
15.1. Setting security policy by extending the Smarty_Security class
15.2. Setting security policy by instance of the Smarty_Security class
15.3. Enable security with the default settings
15.4. changing Smarty settings by template
15.5. register plugins by template
15.6. Template inheritance example
15.7. Template inheritance by template resource extends:
15.8. Stream from PHP
15.9. Stream from Template
15.10. Stream Variable
15.11. Using a registered or assigned object
15.12. static class access syntax
15.13. Using a template prefilter
15.14. Using a template postfilter
15.15. Using a template outputfilter
15.16. Example using MySQL as a cache source
15.17. Using templates from the $template_dir
15.18. Using templates from any directory
15.19. Using templates from windows file paths
15.20. Using templates from strings
15.21. Using template inheritance from the PHP script
15.22. Using custom resources
15.23. Using the default template handler function
16.1. function plugin with output
16.2. function plugin without output
16.3. A simple modifier plugin
16.4. More complex modifier plugin
16.5. block function
16.6. A simple compiler function
16.7. prefilter plugin
16.8. postfilter plugin
16.9. An output filter plugin
16.10. resource plugin
16.11. insert plugin
17.1. Smarty errors
17.2. PHP parsing errors
17.3. Other common errors
18.1. Printing &nbsp; when a variable is empty
18.2. Assigning a template variable its default value
18.3. Passing the title variable to the header template
18.4. Using date_format
18.5. Converting form date elements back to a timestamp
18.6. Using {insert} to write a WML Content-Type header
18.7. componentized template
18.8. Example of template the Obfuscating an email address

本文地址 : http://www.fengfly.com/plus/view-214042-1.html
标签: 在线手册 smarty Smarty3
最新评论 查看所有评论
发表评论 查看所有评论