PHP Classes

Category Tree: Generate an HTML tree of a category items database

Recommend this page to a friend!
  Info   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 6,193 All time: 361 This week: 488Down
Version License Categories
category_tree 1.0GNU General Publi...HTML, Databases
Description 

Author

This class can generate an HTML table with a tree of links to an hierarchical list of items retrieved from MySQL dabatase tables.

It can used to generate hierarchical navigation menus to browse categories of products to display in a site.

Picture of abstract80
Name: abstract80 <contact>
Classes: 1 package by
Country: France, Metropolitan
Age: ???
All time rank: 4592 in France, Metropolitan
Week rank: 206 Up1 in France, Metropolitan Up

Details

This class transforms a n-tree into a 2d array, expanding the selected branch. It has to be used to generate hierarchic menus with categories which contains products. For this class application, you have to know that only categories with at least one associated product are visible. The tree shows the different categories but not the categories'products. If you want to see them, you should write an application which selects the products in the clicked category and print them. Categories and products belong to two tables in the database and they are created when you load the two scripts. --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------ Which documents are in the compressed file? ---------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- You can find : - A Class which contains the two classes which are at the present time in the program - A doc tree.php which enables you to define a tree - A category.php4 which helps you to manage categories - Two scripts in order to create the two tables and the contents for the example in your database (Mysql) that you have already created before. - A php document (DB_connect.php4) where you have to fill in your host, your username, its password and your database name. These information are nessecary for the database connection. - An other php document which is called example.php4.It enables you to show and test the tree. - A screenshot.gif in order to see an outline of the tree when we will print it. --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------- How to use the compressed file? ------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- After you have downloaded the compressed file, you should : 1. Load the two scripts in the SQL file in your Mysql database. Thanks to that, you will create the two tables in order to use this tree application example. 2. Replace the information in the DB_connect.php4 document in order to allow the connection to the application database. You fill there your mean of connection (ex: "localhost"), your user for the database connection (ex: "root") and the password for this user. You also must indicate your database name. 3. Finally, you can load the example.php4 and see the tree!

Screenshots (1)  
  • screenshot.gif
  Files folder image Files (8)  
File Role Description
Plain text file category.sql Data sql for category's table
Plain text file Category_class.php4 Class category's class
Plain text file DB_connect.php4 Conf. database connection
Plain text file example.php4 Example example
Plain text file product.sql Data sql for product's table
Plain text file readme.txt Doc. Documentation
Plain text file Tree_class.php4 Class tree's class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:6,193
This week:0
All time:361
This week:488Down
User Ratings User Comments (1)
 All time
Utility:65%StarStarStarStar
Consistency:65%StarStarStarStar
Documentation:68%StarStarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:53%StarStarStar
Rank:2261
 
just a little out of date but it works fine.
7 years ago (zinsou A.A.E.Moïse)
60%StarStarStarStar