Summary of variable operators commonly used by Smarty.
Capitalize [First letter capitalization]
Count_characters [Count of characters]
Cat [Connection string]
Count_paragraphs [Count of paragraphs]
Count_sentences [Count of sentences]
Count_words [Count of words]
Date_format [Time format]
default [Defaults]
Escape [Transcode]
indent[Indent]
lower[Lowercase]
nl2br[newline character replaced by
]
regex_replace[Regular Replacement]
replace[Replace]
spacify[intervening spaces]
string_format[string Formatting]
strip[removal (extra spaces)]
strip_tags[Remove HTML tags]
Truncate[Intercept]
Upper[Caps]
wordwrap[line width constraint]
{$cook _hotelarr|count} [Array Max subscript]
{section name=s loop= $stu}
{$stu [S].name}
{Sectionelse}
No content
{/section}
$smarty->cache_dir= "/caches/"; Cache Directory
$smarty->caching=true; Cache is turned on, flase cache is invalid
$smarty->cache_lifetime=60; Cache time
$smarty->display ("Cache.tpl", cache_id); Create a cache with ID
$smarty->clear_all_cache (); Clear all Caches
$smarty->clear_cache ("index.htm"); Clear the INDEX.TPL cache
$smarty->clear_cache ("index.htm", cache_id); Clears the cache for the specified ID
Index.htm
{Insert Name= "Get_time"}
index.php
function Insert_get_time () {
Return Date ("y-m-d h:m:s");
}
The literal data is treated as text, and the template ignores all character information inside it. This feature is used to display JavaScript scripts that may contain character information, such as curly braces
{literal}
{/literal}
Strip the leading and trailing spaces and carriage returns of the data in the tag. This ensures that the template is easy to understand and does not cause problems with unnecessary whitespace. Usually put in the beginning and end of HTML code
File cache processing under the same domain name
such as the station of the same file, loading multiple parameters can be resolved
$smarty->display ("hotel.htm", $cityId);
Articles you may be interested in
- Smarty Template Variable operator summary
- Use PHP functions in Smarty Templates and how to use multiple functions for a variable in a smarty template
- Smarty Template Retention Variables Summary
- Smarty include file methods for using variables
- Smarty Loop operation
- Escaping user-passed variables, from Ecshop
- JavaScript gets the current position of the mouse (compatible with IE and Firefox)
- Use PHP function memory_get_usage to get the current PHP memory consumption to achieve program performance optimization
http://www.bkjia.com/PHPjc/764163.html www.bkjia.com true http://www.bkjia.com/PHPjc/764163.html techarticle Summary of variable operators commonly used by Smarty. Capitalize [capitalize] count_characters [count characters] cat [connection string] count_paragraphs [Count of paragraphs] count_sentences [count ...