Learning PHP from an instance

Source: Internet
Author: User
Many features of PHP in 3PHP practice are related to other software or tools. Using the PHP knowledge we have learned so far, we can try to build a simple interaction website. We can learn a lot from this process. Okay, now we have 3 PHP practices
Many features of PHP are related to other software or tools. Using the PHP knowledge we have learned so far, we can try to build a simple interaction website. We can learn a lot from this process. Well, we are now beginning to focus on the construction of a typical personal website.

3.1 plan a site
Generally, a personal site contains a welcome page, a message book page, a bookmarkdonpage, a counter, contact information, and even a collection of photos and music files. Let's start with a title page, a contact information page, and a resume page. We also need to scale the general page header and bottom.

Webpage --front.html


Here we have a very simple html file:


<BR> my personal homepage -- welcome <BR>



My personal homepage


Welcome



Welcome to my cold house, although there is nothing at the moment.



But I hope I can add more immediately.





Copyright? Me, 1999





Contact Information page --count.html

We also have a simple page:


<BR> my personal homepage -- Contact Information <BR>



My personal homepage


Contact Information



You can contact me through 1-800-PHP-INFO





Copyright? Me, 1999






3.2 HTML to PHP

As you can see above, each page has the same header and bottom. As shown in the preceding figure, each page can write the same information when the workload is low, but imagine how much effort you will spend when there are more than 100 pages and you need to change all of their headers or bottoms? How tedious and boring is manual changes on one page! Therefore, we should write PHP headers and bottom files for these pages, and then we just need to reference them in each HTML page. We will put these include files under a subdirectory named include. Next we will write the general content of these sites into the file.

General site variable settings: common. inc
// General site variables
$ MyEmail = 'phptalk @ tnc.org ';
$ MyEmailLink = '$ MyEmail ';
$ MyName = 'php Tal ';
$ MySiteName = $ MyName.'s Home Page ';
?>

General page header: header. inc
// Define the general page header
?>


<BR> <? Echo '$ MySiteName-$ title';?> <BR>


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.