A PHP class tree (supports unlimited classification)_PHP tutorial
WBOY
Release: 2016-07-21 16:09:04
Original
789 people have browsed it
Recently, there have been a lot of questions asked about infinite classification trees, so I was happy to write one myself. I just finished it. You can use it to see how to implement it faster and simpler. Post your tree as well (required) Only query the database once)
This is a class tree with a classification list, supporting unlimited classifications
A classification can have both "classification containing subclasses" and "Final classification";
The only advantage is that ***** only needs to perform a database ***** query once.
It doesn’t look very good It looks good, but it can be customized and modified. You can define your own css and add it
Caching has not been done yet, you can make it up yourself
The directory structure of the example below is like this. ¦--Catagory.php
class Catagory{ //Basic classification data var $treeData = array(); //Classified hierarchical structure array, with the id value of the category as the key of the array var $treePList = array(); //Relationship between self-categorization and parent class var $treeCList = array(); /* /* This is a template for large classification * * __id__ The number of the category The name of the category The name of the category $imgOpen or $imgClose * __open__ Whether the category is currently expanded * __inner__ Sub-category Shown location
* The style can be modified according to your own needs, but existing elements cannot be deleted */ var $blockTpl = '
http://www.bkjia.com/PHPjc/314589.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314589.htmlTechArticleRecently, there have been a lot of questions about infinite classification of class trees, so I was happy and wrote one myself. I just finished it. , let’s try it and see how it can be implemented faster and simpler. Post your tree too...
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