Simple PHP page Architecture

Source: Internet
Author: User

Http: // localhost/index. php? Action = newslist

 

1. <? PHP require (... The public function library will be loaded here...)?>
2. <? PHP Include ("Top. php")?> // Create a top. php file to parse the website header.

What is the header?

Is <HTML>

<Head> ...... </Head> content here. Here we will process the common elements and custom display titles or load different scripts.

3. The content template to be displayed should be loaded here.

For example, if I create a newslist. php file (Note: This file does not contain the head or body mark and is directly displayed as a naked service content), the Code is as follows:

<Body>

<Div id = "out"> // a DIV at the outermost layer controls the basic width and style of the page.

<? PHP Include ($ _ Get ["action"]. "php")?> // You can load different pages based on different parameters.

Of course, you need to make some judgments during the actual operation, such as whether the file exists or not.

</Div>

// Newslist. php should be directly <ul> or <div> or <DL> to display business data

// Of course, other user-defined functions such as require can be continued in newslist. php.

4. <? PHP Include ("bottom. php")?> // Create a bottom. php file to parse the website's tail.

Note that this file must contain the </body> mark.

 

 

 

So any page access mode is index. php? Action = XXXXX

So your website is already in Plug-In mode. (Just preliminary)

If you use 301 redirection or the Apache. htaccess file, the use of pseudo-static page addresses is more perfect.

Reposted: [happy to learn PhP100 days] day 6: Go to the PHP fun page (basic)

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.