Smarty variable operator summary_php tutorial

Source: Internet
Author: User
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}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.