Not the usual PHP folder indexing
Posted: Wed Sep 10, 2008 4:56 pm
Let me explain my problem.
I have a list of folders. The top level folder contains subfolders. Each subfolder contains the same structure. Something like this:
Top Level Folder
• Subfolder1
o Project_Contents
Changes
Examples
Requests
Other
• Subfolder2
o Project_Contents
Changes
Examples
Requests
Other
• Subfolder3
o Project_Contents
Changes
Examples
Requests
Other
I hope the list above helps explain the structure. Within each subfolder I also have an index.php and a project.php file.
I have been trying to figure out how to have each project.php page auto index the folders contents. So far I have been working with getting index.php to autoindex the folder contents and then use php include to list the data on the page. I have been toying with Autoindex from sourceforge but it doesn’t allow me to do it the way in need to.
I can index the contents but it only lists the names of the folders. It doesn’t show subfolders or the contents within the subfolders.
<?php
if ($handle = opendir('./project_contents/')) {
echo "Files:\n";
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}
?>
Any suggestions?
I have a list of folders. The top level folder contains subfolders. Each subfolder contains the same structure. Something like this:
Top Level Folder
• Subfolder1
o Project_Contents
Changes
Examples
Requests
Other
• Subfolder2
o Project_Contents
Changes
Examples
Requests
Other
• Subfolder3
o Project_Contents
Changes
Examples
Requests
Other
I hope the list above helps explain the structure. Within each subfolder I also have an index.php and a project.php file.
I have been trying to figure out how to have each project.php page auto index the folders contents. So far I have been working with getting index.php to autoindex the folder contents and then use php include to list the data on the page. I have been toying with Autoindex from sourceforge but it doesn’t allow me to do it the way in need to.
I can index the contents but it only lists the names of the folders. It doesn’t show subfolders or the contents within the subfolders.
<?php
if ($handle = opendir('./project_contents/')) {
echo "Files:\n";
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
}
?>
Any suggestions?