PHP Advanced: Realize Infinite Classification (1)

Source: Internet
Author: User
1. Analysis of





we use PHP to create a site, classification is very important, under the classification and then classification of the second category called the secondary classification, and now most of the site classification is only divided into the third category:





first Classification (parent classification)--> second classification (subcategory)--> Third classification (sun classification)




The more
this phylogenetic taxonomy, the control of procedures and databases is increasingly complex and difficult. Classification processing and control at the same level is very simple, because only one database is required to record this level of classification, such as: System, News classification, at this level processing is very simple, But for a site, the first level of classification is not enough, but also need to classify, such as:





system-->linux,windows


News-->linux News, Windows News





so the classification is clearer, at least it is clear that the system includes Linux and Windows, while the news includes Linux news and Windows News, in order to make the information more clear, and then continue to classify:





linux--> System Tools, kernels, programming languages, development tools


...





classification to the third level, the processing of information more clearly, in other words, in order to deal with the data very clearly, the more detailed classification of the more convenient, so that the convenience of processing information and user-friendly purpose to find the necessary information clearly, but with the continuous refinement of classification, in the process and database control will become more and more difficult.





Difficulty One: How do you deal with these interrelated kinship categories in a database?


difficult two: How to use PHP to complete this clear relationship?





This hierarchical and fine-grained classification is a problem that every PHP programmer must solve, because it is inevitable to create a good and excellent classification of the site, and solve the problem is quite complex, the biggest problem is the classification of the database processing, Because if the database is improperly handled, it can create a huge workload and even have to redesign the database ...





This is not exaggeration, because many people in the database processing will use the first level classification to establish a database practice, I was also adopted this method to deal with the classification, because most of the site is divided into the third level, so the database only need three classification database to deal with. But when you need to continue sorting down, The drawbacks of this approach are revealed, because the more down, the workload, the program will be a huge increase.





I want to introduce the method is how to use a classification database to create an unlimited downward classification method, users who have used Windows know that Windows folders can create an unlimited rating of the directory, you can continue to build the directory under the directory, so the endless division, Linux Directory creation, which is the same as the one I'm introducing.





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.