ThinkPHP makes the/cms/tpl/Index/Public method original in the template without parsing (direct output)

Source: Internet
Author: User
This article mainly introduces ThinkPHP's method of making cmstplIndexPublic output directly without parsing the template. It involves the technique of modifying the default variable replacement through template constant settings and has some reference value, for more information, see

This article mainly introduces ThinkPHP's method of making/cms/tpl/Index/Public directly output without parsing the template. It involves the technique of modifying the default variable replacement through the template constant setting, it has some reference value. For more information, see

This example describes how ThinkPHP does not parse the template by making/cms/tpl/Index/Public. Share it with you for your reference. The details are as follows:

Problem:

The template contains/cms/tpl/Index/Public and needs to be output directly. However,/cms/tpl/Index/Public is directly replaced with the current Public template directory, and the final output is: /project directory/Tpl/default/Public/

Solution:

Add template constant settings in config. php:

'Tmpl _ PARSE_STRING '=> array ('/cms/tpl/Index/public' => "/cms/tpl/Index/Public ",) // The string to be automatically replaced by the template engine, which must be an array.

Set/cms/tpl/Index/Public to the original output.

I hope this article will help you with ThinkPHP programming.

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.