Thinkphp Study Notes (iii) questions about the path to URLs in the project and the use of frame to build the page

Source: Internet
Author: User
Thinkphp Study Notes (iii) The path problem of URLs in the project and the use of frame to build the page


There are a number of custom constant paths in thinkphp, as follows:

echo "^_^ Hello, Welcome to usethinkphp"; System constants Definition//Go to thinkphp Manual for Find//echo "
"." The root directory address of the Web site ". __root__." ";//echo"
"." Portal file Address ". __app__." ";//echo"
"." Current module address ". __url__." ";//echo"
"." Current URL address ". __self__." ";//echo"
"." Current action address ". __action__." ";//echo"
"." Template directory for the current module ". __current__." ";//echo"
"." The current operation name. Action_name. " ";//echo"
"." Current project directory. App_path. " ";//echo"
"." The current project name. App_name. " ";//echo"
"." The template directory for the current project. App_tmpl_path. " ";//echo"
"." The public file directory for the project. App_public_path. " ";//echo"
"." The configuration file directory for the project. Config_path. " ";//echo"
"." The public file directory for the project. Common_path. " ";///auto-cache all information related to the table//echo"
"." The data file directory for the project. Data_path. "Runtime Data Directory";//echo "
"." ". Group_name. ""; /echo "
"." ". is_cgi."; /echo "
"." ". Is_win."; /echo "
"." ". Lang_set. ""; /echo "
"." ". Log_path. ""; /echo "
"." ". Lang_path. ""; /echo "
"." ". Tmpl_path. ""; //////js put in a location for multiple applications of public resources//echo "
"." ". Web_public_path. "";

Login Page

 
  Insert Title hereTemplate path __url__: The URL address of the current module
.. /public the public directory of the current template
__public__ Public directory with home directory, for multiple project applications
__tmpl__ Project Template Catalog
URL of the __APP__ project
__action__ the URL address of the current operation
__self__ link to the current entire path

Get page:

 
  Insert Title here
 
  
 
  
 
  


Gets the action:

 
  Verify ();            }      Public function Fuck () {        header ("content-type:text/html; Charset=utf-8 ");        echo "Useraction.the world!";        $this->verify ();            }    Private Function Verify () {    $this->display ();    echo "
Useraction. Authentication method "; } Public Function Login () { $this->assign ("content", "This is the contents ah"); $this->display (); echo "
Useraction. Authentication method "; } Public function Add () { dump ($_post); echo $_post[' username ']; $this->assign ("username", $_post[' username ']); $this->display (); }}? >


Use frame to build a page: Do not introduce static HTML files, should be filled in the action method, as follows:

Indexaction

 thinkphp"; System constants Definition//Go to thinkphp Manual for Find//echo "
"." The root directory address of the Web site ". __root__." ";//echo"
"." Portal file Address ". __app__." ";//echo"
"." Current module address ". __url__." ";//echo"
"." Current URL address ". __self__." ";//echo"
"." Current action address ". __action__." ";//echo"
"." Template directory for the current module ". __current__." ";//echo"
"." The current operation name. Action_name. " ";//echo"
"." Current project directory. App_path. " ";//echo"
"." The current project name. App_name. " ";//echo"
"." The template directory for the current project. App_tmpl_path. " ";//echo"
"." The public file directory for the project. App_public_path. " ";//echo"
"." The configuration file directory for the project. Config_path. " ";//echo"
"." The public file directory for the project. Common_path. " ";///auto-cache all information related to the table//echo"
"." The data file directory for the project. Data_path. "Runtime Data Directory";//echo "
"." ". Group_name. ""; /echo "
"." ". is_cgi."; /echo "
"." ". Is_win."; /echo "
"." ". Lang_set. ""; /echo "
"." ". Log_path. ""; /echo "
"." ". Lang_path. ""; /echo "
"." ". Tmpl_path. ""; //////js put in a location for multiple applications of public resources//echo "
"." ". Web_public_path. ""; $this->display (); Public Function Top () {$this->display (); The public function left () {$this->assign ("content", "This is the contents ah"); $this->display (); Public Function Right () {$this->display (); }//Access mode: Path_info//http://localhost/mythinkphp/admin.php?m=index&a=hello//http://localhost/mythink php/admin.php/index/hellopublic function Hello () {header ("content-type:text/html; Charset=utf-8 "); echo "This is my own method Oh!" "; /** * Template Use * Capitalization be sure to note that */public function template () {//must create the same folder as the current controller name under the default of the TPL for the corresponding project index//and then the HTML file name The method name//default delimiter method {$content}//can be modified in the template Compass $this->assign ("content", "small monk down to Huazai, Old Monk has confessed"); $this->display ();/ 1. Specify the new template//$this->display ("NewTemplate") below the peer,//2. Cross-Controller reference templates (you can also add grouping information)//$this->display ("group: User:verify");// 3. Cross-skin references//$this->display ("[email protected]:verify");//4. Full path output (new public folder in Project sibling)//The location of the loaded file is all in the main entryTo locate//$this->display ("./public/ss.html"),//display parameters//$this->display ("position", "Utf-8", "Text/xml"); }}?>

Index.html

 
  

Left.html

 
  I am a template I am a template
{$content}
I am a template I am a template

Right.html top.html

 
  I am a template I am a template



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