Smarty variable Operator summary. Summary of common variable operators in smarty. Capitalize [uppercase letters] count_characters [number of computing characters] cat [connection string] count_paragraphs [calculates the number of paragraphs] count_sentences [calculates the summary of common variable operators used by smarty.
Capitalize [uppercase letters]
Count_characters [count characters]
Cat [connection string]
Count_paragraphs [calculate the number of paragraphs]
Count_sentences [calculate the number of periods]
Count_words [count words]
Date_format [time format]
Default [default]
Escape [transcoding]
Indent [indent]
Lower [lower case]
Nl2br [replace line breaks
]
Regex_replace [regular expression replacement]
Replace [replace]
Spacify [blank]
String_format [string formatting]
Strip [remove (extra space)]
Strip_tags [remove html tags]
Truncate [truncate]
Upper [uppercase]
Wordwrap [row width constraints]
{$ Cook_hotelArr | count} [maximum array subscript]
{Section name = s loop = $ stu}
{$ Stu [s]. name}
{Sectionelse}
No content
{/Section}
$ Smarty-> cache_dir = "/caches/"; // cache Directory
$ Smarty-> caching = true; // When cache is enabled, the cache is invalid.
$ Smarty-> cache_lifetime = 60; // cache time
$ Smarty-> display ("cache. tpl", cache_id); // create a cache with an ID
$ Smarty-> clear_all_cache (); // clear all caches
$ Smarty-> clear_cache ("index.htm"); // clear the cache of index. tpl
$ Smarty-> clear_cache ("index.htm", cache_id); // clear the cache of the specified id
Index.htm
{Insert name = "get_time "}
Index. php
Function insert_get_time (){
Return date ("Y-m-d H: m: s ");
}
Literal data is processed as text, and the template ignores all internal character information. this feature is used to display javascript scripts that may contain characters such as braces.
{Literal}