Original: Thinkphp Getting started three-frame templates, variables (47)"Call template on Controller"Display () a template that invokes the name of the current operationDisplay (' name ') invokes the template file of the specified nameController
When the smarty cache is enabled, the compiled output file will be saved to the cache directory during the first execution, and then passed the smarty is_cache () the function checks whether the cache file has expired. If it expires, the cache will
The template engine is a program used to merge template files and data content. It facilitates code Separation and Maintenance for website development. It is best to know how a template works, so that you can easily implement a one-way
Http://www.onlamp.com/pub/a/php (as the mainstream development language)/2004/12/09/three_tier.htmlThree-Tier Development with php (as the mainstream Development language) 5By Luis Yordano Cruz12/09/2004
This article demonstrates the powerful
Fread () and fwirte () are used in php (). After a static page is generated, the modification will be involved. Here we can use the regular expression matching method to replace the changed parts in the template. However, this method is too
The strip_tags () function removes tags from HTML, XML, and PHP.Copy codeThe Code is as follows: world! ");?> In smarty, you can use strip_tags to remove html tags, including any content between <>.For example:Index. php:Copy codeThe Code is as
Example 5-8. date_format [Date Format]Index. php:Copy codeThe Code is as follows:$ Smarty = new Smarty;$ Smarty-> assign ('yesterday', strtotime ('-1 Day '));$ Smarty-> display ('index. tpl ');Index. tpl:{$ Smarty. now | date_format}{$ Smarty. now |
9 very useful PHP class libraries, I believe it will certainly provide a better and faster way for your WEB development.
9 very useful PHP class libraries, I believe it will certainly provide a better and faster way for your WEB development.
1.
This article mainly introduces the usage of the smarty built-in function foreach. The example analyzes the usage skills and precautions of the smarty built-in foreach function. For more information, see
This article mainly introduces the usage of
I know the method of outputting static pages using PHP. One is to use the template technology, and the other is to use the ob series functions. Both methods look similar, but they are actually different.First: Use templates. At present, PHP
There are some differences between getting the current date time and formatting the date time in Smarty and PHP. Here we will give you a detailed introduction:
First, obtain the current date and time:In PHP, we use the date function to obtain the
Smarty learning notes: common code snippet usage summary, smarty learning notes
This example describes common code segments of smarty. We will share this with you for your reference. The details are as follows:
1,
{html_options values=$cust_ids
Allocation data type of the smarty template engine
This article mainly introduces the distribution data type of the smarty template engine. The instance analyzes the usage skills of the smarty template engine data type and has some reference value.
Smarty templates are used in order to separate the user interface and business data
Install smarty, official download URL:http://www.smarty.net/download.php
Once extracted, simply copy the folder "Libs" folder to the root directory.
and Libs only
: This article mainly introduces Smarty-1 (18). For more information about PHP tutorials, see. Smarty
I. Template principles
1. Why use a template?
1) scenario:
For ($ I = 0; $ I
Echo''. $ Row ['proname'].'
}
The above code is used to mix html and
The directory structure of my smarty configuration is as follows: smarty_pro1 & nbsp; --- libs & nbsp; --- config & nbsp; --- templates (here I put one, index. tpl) & nbsp; --- templates_c & what's wrong with my smarty configuration?
The directory
The template technology of the php template smartyphp should be mentioned frequently. like the famous phplibfasttemplate, the MVC model is basically implemented, and the work cannot be solved, currently, there are not many templates, because there
The cache application implementation code in the smarty template engine in php. For more information, see.
1. Smarty cache configuration:
The code is as follows:
$ Smarty-> cache-dir = "directory name"; // create a cache directory name$ Smarty->
PHP template technology should be often mentioned, like the more famous Phplib Fasttemplate, have basically implemented the MVC pattern, the work is not abrasive, now with the 2 template is not much, because there is another template class Smarty,
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.