PHP Classes

PHP Folder Structure: Show the information on folders and files

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 128 All time: 9,386 This week: 69Up
Version Licenses PHP version Categories
folder-informations 1.0.0Custom (specified...5HTML, PHP 5, Files and Folders
Description 

Author

This class can show the information on folders and files.

It can take the path of a folder and extract the list of files and folders it contains.

The class can also generate HTML to display the list of files and folders on a Web page.

Picture of Win Aung Cho
  Performance   Level  
Name: Win Aung Cho is available for providing paid consulting. Contact Win Aung Cho .
Classes: 11 packages by
Country: Myanmar Myanmar
Age: 60
All time rank: 24994 in Myanmar Myanmar
Week rank: 44 Up1 in Myanmar Myanmar Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php
include("FolderInfo.php");
/**
 * example for FolderInfo Class
 *
 * This class is free for the educational use as long as maintain this header together with this class.
 * Author: Win Aung Cho
 * Contact winaungcho@gmail.com
 * version 1.0
 * Date: 4-12-2022
 */
?>
<!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.60">
        <style>
        li {
            list-style: none;
            padding-left: 12px;
        }
       
        li::before {
            content: attr(data-style-type) " ";
            background-color: #bef;
        }
        span {
            background-color: #bef;
        }
        table { border: none }
        td, th{
            font-size: 1rem;
            min-width:90px;
            border-bottom: 1px solid #ddd;
        }
        </style>
    </head>

    <body>
<?php
$folderinfo
= new FolderInfo();
$folderinfo->printAll();
?>
<script>
            window.onload = function() {
                var li_ul = document.querySelectorAll(".collapse li ul");
                for(var i = 0; i < li_ul.length; i++) {
                    li_ul[i].style.display = "none";
                };
                var exp_li = document.querySelectorAll(".collapse li > span");
                for(var i = 0; i < exp_li.length; i++) {
                    exp_li[i].style.cursor = "pointer";
                    exp_li[i].onclick = showul;
                    exp_li[i].parentNode.dataset.styleType = '+';
                    exp_li[i].parentNode.style.padding = '0px';
                };

                function showul() {
                    nextul = this.nextElementSibling;
                    while(nextul) {
                        if(nextul.matches('ul') || nextul.matches('ol')) break;
                        nextul = nextul.nextElementSibling;
                    }
                    if(nextul.style.display == "block") {
                        nextul.style.display = "none";
                        this.parentNode.dataset.styleType = '+';
                    } else {
                        nextul.style.display = "block";
                        this.parentNode.dataset.styleType = '-';
                    }
                }
            }
            </script>
    </body>

    </html


Details

Folder-Informations

Traverse the folder recursively and collect the several informations such as number of files count and size for each file type. Product html tree using list elements and links to view some text, video and image files.

Example use

First include the FolderInfo.php class in your file, and use the class as following to generate the HTML for the math expressions:

$folderinfo = new FolderInfo();
$folderinfo->printAll();

Tree list of folder content

Folder-Informations

Table of file types, their size and count in total

Folder-Informations


Screenshots (2)  
  • folderinfo1.jpg
  • folderinfo2.jpg
  Files folder image Files (6)  
File Role Description
Accessible without login Plain text file example.php Example Example script
Plain text file FolderInfo.php Class Class source
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

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  
 100%
Total:128
This week:0
All time:9,386
This week:69Up