New features of thinkphp v3.1 Development framework: Content resolution output

Source: Internet
Author: User
Keywords Development framework new features thinkphp content parsing output
Tags added content content parsing output development development framework file framework function

The process of page output in thinkphp is to read the template file, and then to parse the template (also support the invocation of Third-party template engine parsing), but there are some cases where we do not define the template file, or save the template file in the database, then when the page output, We were unable to read the template file, and the 3.1 version added the function of content parsing output.
The built-in template engine is also perfected, and if the incoming template file does not exist, it is considered the incoming template parsing content, so 3.1 view classes and http://www.aliyun.com/zixun/aggregation/16339.html "> The action class has also made some improvements.
The display method is used for template file render output, the Show method is used for the template content rendering output, and the Show method still supports the content parsing function, so we can use this in the controller:

$this->assign (' name ', ' thinkphp '); $this->show (' hello,{$name}! ');

The results of the page output are:

hello,thinkphp!

You can also read the database by:

$content = M (' Data ')->where ($map)->getfield (' content '); $this->show ($content);

For the contents of the $content variable, you can support the parsing of variables and tag libraries as well as template files, and you can also support template layout features.
The Show method can also specify the output encoding and type, for example:

$this->show ($content, ' utf-8 ', ' by ');

In short, with the Show method, you can put the template in the database, the template management and update is also more convenient.

Related Article

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.