PHP Advanced: Implementing Unlimited Categories Page 1/4_PHP Tutorial

WBOY
Release: 2016-07-21 15:59:31
Original
850 people have browsed it

1. Analysis

When we use PHP to create a website, classification is very important. Below the classification, the second classification is called the sub-classification. However, most website classifications are now only divided into the third classification. Category:

First category (parent category)-->Second category (child category)-->Third category (grandchild category)

The more related categories there are, The control of programs and databases becomes more and more complex and difficult. Classification processing and control at the same level is very simple, because only one database is needed to record the classification at this level, such as: system, news and other classifications. The processing at this level is very simple, but for a website, the first-level classification is not enough. It needs to be classified again, such as:

System-->linux,windows
News-- >linux news, windows news

This classification will be clearer, at least people will understand that the system includes linux and windows, and the news includes linux news and windows news. In order to make the information clearer, I will Continue to classify:

linux-->gt; system tools, kernel, programming language, development tools
...

When the classification reaches the third level, the processing of information becomes clearer , that is to say, in order to process the information clearly, the more detailed the classification, the more convenient it will be. This will not only facilitate the processing of information, but also make it easier for netizens to find the information they need with a clear purpose. However, with the continuous refinement of classification, the control of programs and databases will become more difficult. It will become more and more difficult.

Difficulty one: How to deal with these related kinship classifications in the database?
Difficulty two: How to use php to complete this clear relationship?

This kind of multi-level and detailed classification is a problem that every PHP programmer must solve, because the classification problem of making a good and excellent website is inevitable, and solving this problem is quite complicated, among which the biggest The problem is the classification processing of the database, because if the database is not handled properly, it will bring a huge workload and even have to re-plan the database...

This is not an exaggeration, because many people are bad at database processing. Use the first-level classification method to build a database. I also adopted this method to deal with classification at the time. Since most websites are classified into the third level, there are only three classification databases in the database for processing. But you need to continue down. When classifying, the disadvantages of this approach are revealed, because the further down the division, the workload and program volume will increase dramatically.

The method I want to introduce is how to use a classification database to create The classification method of infinite downward grading. Readers who have used Windows all know that the Windows folder can create an infinite grading directory, and you can continue to create directories under the directory, so that the classification goes on endlessly. Linux directory creation also has this function , the method I introduced is the same as this form.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317384.htmlTechArticle1. Analysis When we use php to make websites, classification is very important. Below the classification, we will classify this The second category is called the sub-category, but now most website categories are only divided into the third category: The first category...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template