PHP Classes

PHP TreeView: Display a collapsible tree from a MySQL query

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum (6)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 52%Total: 2,779 This week: 1All time: 1,363 This week: 560Up
Version License PHP version Categories
php-treeview-class 1.6BSD License5HTML, PHP 5, Databases
Description 

Author

This class can display a collapsible tree from a MySQL table database query.

It can perform a SQL SELECT query to a given MySQL database table and generates HTML and JavaScript to display a collapsible tree of entries.

The table fields from where the class takes the entries identifier, parent entry identifier, entry title are configurable parameters.

Picture of Mohammad Keramatifar
  Performance   Level  
Name: Mohammad Keramatifar <contact>
Classes: 4 packages by
Country: Iran Iran
Age: 40
All time rank: 7947 in Iran Iran
Week rank: 416 Up4 in Iran Iran Up

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

<title>Keramatifar Treeview Right-To-Left Sample</title>
<link rel="stylesheet" type="text/css" href="ltr.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="funcs.js"></script>
</head>
<body>
 
 <?php
 
 
//include the treeview class
 
include 'class.treeview_new.php';
//create an instant of Treeview Class
 
$treeSample = new Treeview('localhost','root','','hk');
 
//Calling the method to generate tree view and set the queryArray public member for Input Parameter
 
$treeSample->CreateTreeview('hk','id','title', 'parent_id', 'perfixForJqueryIDs');
 
//echo the public member of object names treeResult (Contain the treeview html and jquery codes)
 
echo $treeSample->treeResult;

?>

 

</body>
</html>


Screenshots  
  • LeftToRight
  • RightToLeft
  Files folder image Files  
File Role Description
Plain text file class.treeview_new.php Class Treeview new updated main class
Accessible without login Plain text file example_rtl.php Example Right To Left example file
Accessible without login Plain text file funcs.js Data Script File Fro Controling Cliend Side PArt
Accessible without login Plain text file hk.sql Example Mysql sample database
Accessible without login Plain text file jquery.js Data jquery file needed for client side part
Accessible without login Plain text file ltr.css Data css for left to right
Accessible without login Image file ltr.gif Icon Image File For Left to Right Styles
Accessible without login Plain text file rtl.css Data CSS file for Right to Left
Accessible without login Image file rtl.gif Icon Image File For Right to Left Styles
Accessible without login Plain text file sample.php Example Example

 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,779
This week:1
All time:1,363
This week:560Up
User Ratings User Comments (2)
 All time
Utility:79%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:-
Examples:66%StarStarStarStar
Tests:-
Videos:-
Overall:52%StarStarStar
Rank:2274
 
It works on jquery 1.
10 years ago (Roberto Mantovani)
47%StarStarStar
Dude, this code is perfect! I do not need but recreates it fo...
11 years ago (Ediaimo Borges)
70%StarStarStarStar