thinkphp template substitution and system constants and application

Source: Internet
Author: User

Default Template substitution rules:

. /public  :   usually  /   project directory  /tpl/default/public/

__public__  : It will be replaced with the public directory of the current site   usually  /public/

__tmpl__       usually  /   project directory  /tpl/default/


__app__      url   address  

__url__      url   address (without domain name)

__action__  : Will replace the current operation of the  url   address  

__self__ : will replace the current page URL

You can also customize the substitution rule by configuring the value of Tmpl_parse_string in the project configuration file, such as:

Tmpl_parse_string + = Array (

     ' __public__ ' = ' /common ' , // Change the default__public__substitution Rules

       < Span lang= "en-us" xml:lang= "en-us" > ' __upload__ '  =>&NBSP;  < Span style= "Color:rgb (221,0,0);" > '/public/uploads/'    //    add new upload path substitution rules



file path: aoli/home/tpl/default/user/index.html

  <p>__root__ represents the URL of the current website </p>
  <p>_ _URL__ represents the URL address of the current module/index.php/user</p>
  <p>.. /public represents/aoli/tpl/default/public</p>
  <p>__public__ represents the project public file directory/public</p>
  <p>__tmpl__ represents the template directory for the current project/aoli/tpl/default/</p>
  <p>__app__ Represents the entry file address of the current project/index.php</p>
  <p>__action__ represents the current action address/index.php/user/index</p>
  <p>__self__ represents the current URL address/index.php/user/</p>
  <form action= "__url__/add" method= "post";
    <input type= " Text "name=" username "/>
    <input type=" Submit "value=" register "/>
  < /form>

File path: aoli/home/lib/action/useraction.class.php


  class Useraction extends Action {
        function index () {
            $this- >display ();          
       function Add () {
            dump ($_post);      


Access path: Http:// input content, click the Register button to jump to Http:// and execute the Add method under the User module, Outputs the submitted content.

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: 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.