The following are examples of accessing page request variables such as get,post,cookies,server,enviroment and session variables. For example {$smarty. server.server_name} Gets the server variable, {$smarty. Env.path} Gets the system environment
Querying data from a database, the browser is displayed in a tabular formatNote the difference between index and iterationIndex is indexed for array subscriptIteration as serial numberTemplate page User Information Sheet index
{extends}In template inheritance, you can use the {extends} tag within a child template to extend the parent template.1.{extends} must be placed on the first line of the template.2. If the child template is to extend the parent template with
Pick up an article11, Section,sectionelse section is a circular structure statement, mainly used to iterate over an arrayGrammar:{Section name= name loop= Loop Array (number of times) start= start (0) step= Step (1) max= maximum number of
Php Tutorial: smarty cache application and controlFirst look at a small programConfigure the php environment in advance. We recommend that you install xampp. 1. Create a project directoryCreate the following directory in the directory:2. Upload All
There is no way to return a page as a string when using $smarty->display ().
View Smarty Source Discovery display is actually called the $smarty->fetch (), found a $diaplay parameter, true when printing the page, False when the return string.
When extracting Fckeditor, use the followingPHP uses $ _ POST ['p _ info'] to obtain the value of FCKeditor.Supplement:1. The basepath path must be the same as the include path above. Otherwise, the file cannot be found)In addition, if you want to
This paper describes the usage of smarty template condition in PHP. Share to everyone for your reference. The implementation method is as follows:
Template file test6.html code:
Smarty Test
{if $cond = = 1}
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|date_format:
General Web page display will inevitably involve the interception of substring, this time truncate on the use of, but it is only suitable for English users, with Chinese users, using truncate will appear garbled, and for Chinese English mixed string,
The following describes the features of the Smarty template engine:
1. Speed: A program written with Smarty can achieve maximum speed, which is relative to other template engine technology.
2. Compile: The program written by Smarty to compile into
Smarty commonly used 20 variable operators * Use syntax: {variable name | operator:}
* Capitalize---First letter capital
* Count_characters---count characters
* Cat---connection string
* Count_paragraphs---Calculation of paragraphs
* Count_sentences-
Here are examples of access to page request variables such as get,post,cookies,server,enviroment and session variables. For example {$smarty. server.server_name} Gets the server variable, {$smarty. Env.path} Gets the system environment variable PATH,
Comments in the template
Each smarty template file is developed by combining the syntax of the web foreground language (xhtml,css and JavaScript) with the Smarty engine.
The language used for the web foreground development is exactly the same as
The following article will be analyzed in a specific example:
Capture label
Capture's Chinese meaning is crawl, its function is to crawl the data of the template output, when we need it, call it to get the purpose of fetching data. The following
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.