Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:16:33+00:00 2026-06-11T15:16:33+00:00

In a website HTML Table, I need to have the table populate with the

  • 0

In a website HTML Table, I need to have the table populate with the names of PDF files located on a specific directory of the website.

Example:

Years on left-side of table: 2010, 2011, 2012
Months across top of table: Jan, Feb, Mar

The data records need to pull from a structured folder setup from the site’s root:

html_public/uploadedfiles/files_type_a/2010/01jan
html_public/uploadedfiles/files_type_a/2010/02feb
html_public/uploadedfiles/files_type_a/2010/03mar

So, a PDF document that has been uploaded into the /01jan folder would display that PDF file’s name in the appropriate cell of the HTML table.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:16:34+00:00Added an answer on June 11, 2026 at 3:16 pm

    This PHP code will iterate through the directory you specify and put all of the PDF files it finds into an array called $files. You may need to adjust the $dir.

    $dir = 'html_public/uploadedfiles/files_type_a/2010/'; //directory to pull from
    $skip = array('.','..'); //a few directories to ignore
    
    $dp = opendir($dir); //open a connection to the directory
    $files = array();
    
    if ($dp) {
        while ($file = readdir($dp)) {
            if (in_array($file, $skip)) continue;
    
            if (is_dir("$dir$file")) {
                $innerdp = opendir("$dir$file");
    
                if ($innerdp) {
                    while ($innerfile = readdir($innerdp)) {
                        if (in_array($innerfile, $skip)) continue;
    
                        $arr = explode('.', $innerfile);
                        if (strtolower($arr[count($arr) - 1]) == 'pdf') {
                            $files[$file][] = $innerfile;
                        }
                    }
                }
            }
        }
    }
    

    This part will make an HTML table and display all of the applicable files:

    <table>
        <? foreach ($files as $directory => $inner_files) { ?>
        <tr>
            <td>Folder: <?= $directory ?></td>
        </tr>
    
            <? foreach ($inner_files as $file) { ?>
            <tr>
                <td>File: <?= $directory ?>/<?= $file ?></td>
            </tr>
            <? } ?>
        <? } ?>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an PHP website which creates and stores HTML template files on server
I want to create a html page that get data from a website table
Working on an AJAX website (HTML,CSS,JavaScript, AJAX, PHP, MySQL). I have multiple javascript functions
I have to build a html website, which will contain about 50+ pages. The
I am very new to WordPress. I have converted a HTML website I created
I have noticed recently, when I apply a template to a new HTML website,
I need help. I have 6 tabs on website. But when i`m clicking to
I have a HTML widget/table that is pulling info from a private server that
On one HTML Page ( From.htm ) I have: <table class=Contents Stylize General> <tr>
I am having an issue with parsing the following website: http://www.x-rates.com/d/USD/table.html I am very,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.