Examples of common methods in smarty and summary of smarty instances. Examples of common methods in smarty, and examples of smarty summary examples in this article summarize common methods in smarty. Share it with you for your reference. Details are
The common methods in Smarty are summarized in this paper. Share to everyone for your reference. Specifically as follows:
1. Use of the index and iteration of foreach in Smarty
. Index contains the current array index, starting at zero.
Index
Examples of common methods in smarty and summary of smarty instances
This example summarizes common methods in smarty. Share it with you for your reference. The details are as follows:
1. Use of indexes and iteration of foreach in Smarty
. Index
Dynamic Web page Authoring tips PHP: Learn more thoroughly smarty
Smarty is a PHP template engine that separates logic programs from external content and provides an easy-to-manage approach.
Smarty requires the Web server to run php4.0.6 and later.
Dynamic Web page Authoring tips PHP: Learn more thoroughly smarty
Smarty is a PHP template engine that separates logic programs from external content and provides an easy-to-manage approach.
Smarty requires the Web server to run php4.0.6 and later.
Basic syntax
All Smarty tags are added with delimiters. In Smarty, all content other than the delimiter is static, and when Smarty encounters a template tag, it tries to interpret them and then output them in the proper way.
{and} are by default,
Getting the current datetime and formatted date time in Smarty is a bit different from PHP, here's a detailed description:
The first is to get the current date time:In PHP we will use the DATE function to get the current time, the instance code is
All Smarty tags are added with delimiters. In Smarty, all content other than the delimiter is static, and when Smarty encounters a template tag, it tries to interpret them and then output them in the proper way.{and} are by default, but they are
Get the current date time and format date time in smarty with some different places in PHP, here is a detailed description:
The first is to get the current date time:In PHP we use the DATE function to get the current time, and the instance code is
Formatted output dates and times in PHP are available: Date (' y-m-d h:i:s ', timestamp); The form of output, corresponding to the "year-month-day: minutes: seconds."
which formats are supported by the Date_format function in Smarty
Date_format
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.