PHP static page Generation static page

Source: Internet
Author: User
Preface:

At present, many Web sites in the news release system has adopted dynamic server technology to generate static HTML practices, the benefits are: one can reduce the burden on their servers, the second is because the generation of HTML static pages, so its Web site by search engines to search the probability of a greater number. The author's website has used PHP this dynamic technology to build news release system, its principle is to use PHP to generate HTML static page technology, the related platform is Windows XP Sp2+php4.32+mysql, therefore, here, want to simply talk about this approach. This article is suitable for PHP+MYSQL database operations, SQL statements and Web design a little bit of a friend, if you are a friend from the beginning, then please lay a good foundation! You don't have to look down here. If you all meet the above conditions, then congratulations, please continue to look down. However, you need to do the following to prepare yourself before you start building a concrete action.

One, have the function of debugging PHP locally

under the Windows XP operating system, I suggest that you can download a Php+mysql+aphche server suite, such as the Huajun Software Park, and go there and search for it. After downloading the default installation can, so you have a local test PHP function, save a lot of manual configuration trouble, how, simple, OK, this is just the first step.

second, the concept of the news release system features

The first page of the news is often updated through the background, the background of the update is simply by adding, editing, delete data and other basic functions realized. Here, you can use web design software to build your desired background interface, the realization of the function of course is to use PHP. This step suggests that you first think about the features that the news release system needs. Here, how to add, edit, delete data in PHP no longer repeats, because the focus is on how to generate static technology on this basis.

Third, PHP to generate the technical principles of HTML.

haha. The cost of saying so much, finally arrived at the place to speak. In fact, this principle is not complex, in general, it should be a substitution data syntax in PHP application. OK, let's talk about a simple example, step-by-step analysis! Believe that smart you can see the slightly, carefully look at each step can be, here, just guide everyone how to do it, concrete can practice it!

(1) Create a new database in MySQL, name it (customizable), create a new table, name News (because it's a press release, take a good name, you can customize it), and then create the names of these fields:
ID (auto increment, which is key, type: INT)
Title (as the name suggests, news headlines, type TEXT)
Content (News contents, type is preferable TEXT)
Path (HTML file path, type preferred TEXT)

(2) Establishment of conn.php
This is connected to the database of PHP files, you can connect the data to the statement alone in this file, the next several need to connect the database file directly refer to the file.

(3) The design adds the news the form add.form the simple source code as follows:

<form method= "POST" action= "add.php" >//Submit to add.php
News title: <input type= "text" name= "title" Size= "><br>"
News content: <textarea name= "Content" cols= "ten" rows= "></textarea><br>"
<input type= "Submit" Name= "submitted &rdqu

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.