ThinkPHP323 Creating project templates and template assignments

Source: Internet
Author: User
ThinkPHP3.2.3 the method of establishing the project template is a bit different from the previous version directory, create a new index directory under the home/view/directory, and then create a new template, such as index.html, test.html, as if there is a "Tpl" in the root directory Directory, under the new index directory


Use


If it is a different name for HTML, such as test.html


So how do you assign a value to a template? The following will use the $this-> variable name and $this->assign ("Variable name", "Variable Value"), and two ways to assign a value

In the IndexController.class.php file

 
  name = $name;        $this->assign ("Variable name", "Variable Value");        $this->assign ("Age", "->assign") ("date", $date);        $this->display ();    }    Public function User ()    {}}
How do I use index.html in a template?
 
  Insert Title hereHello World

"; Echo $date;? >
Output results


Generally use $this->assign () to assign values that can be continuously assigned as

$this->assign ("Age", "->assign") ("date", $date);

The above describes the ThinkPHP323 set up project templates and template assignments, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.

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