Using the tinkphp to achieve a product-style layout

Source: Internet
Author: User

First, the background management template

Background management templates are usually laid out using Frameset/iframe. For example:

<!DOCTYPE HTML><HTML><Head>    <title>Frameset</title></Head><Body>    <Frameset>        <Framesrc= "left.html"></Frame>        <Frameset>            <Framesrc= "left.html"></Frame>            <Framesrc= "right.html"></Frame>        </Frameset>></Frameset></Body></HTML>

But in using framework development we don't go directly to a page, but instead access a controller to get a rendered template. A controller is implemented for the product type structure above.

Second, the controller
<?php namespace Home\controller;  Usemysqli;  UseThink\controller; /**    *     */    classIndexcontollerextendscontroller{ //Render  main view Public functionindex () {$this-display (); } //Render top view  Public functionTop () {$this-display (); } //Render left view  Public functionLeft () {$this-display (); } //Render right view  Public functionRight () {$this-display (); }    }
Three, the template
    • Index.html
<!DOCTYPE HTML><HTML><Head>    <title>Frameset</title></Head><Body>    <Frameset>        <Framesrc= "Localhost/applaction/home/idex/top"></Frame>        <Frameset>            <Framesrc= "Localhost/applaction/home/idex/left"></Frame>            <Framesrc= "Localhost/applaction/home/idex/right"></Frame>        </Frameset>></Frameset></Body></HTML>

Here the SRC is all replaced with the corresponding controller

    • Other views
<!DOCTYPE HTML><HTML><Head>    <title>Frameset</title></Head><Body> This is the right of the</Body></HTML>
Iv. Use of constants

A number of constants have been defined in thinkphp and we can use them directly.

To view the system-defined constants, Get_defined_constants is the function used to get all the constants.

 Public function Getserverconst () {        var_dump(get_defined_constants(true));    }

Frequent use of path-related constants has the following

This is the structure of my project:

Using constants directly in HTML

Access results

Using the tinkphp to achieve a product-style layout

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.