HERE IS MY CODE. I NEED TO OPEN EACH DIRECTORY AND MAKE THE LINKS FOR EACH SUBDIRECTORY. THE PROBLEM IN THIS CODE IS: EACH DIRECTORY HAS THE SAME FILE AS IN THE PREVIOUS ONE.. LIKE FOR EXAMPLE, WEBSITE OUTPUTS:
DIRECTORY1
FILE1
----
DIRECTORY2
FILE1
FILE2
----
DIRECTORY3
FILE1
FILE2
FILE3
----
AND SO ON.... WHAT WRONG AM I DOING. DIRECTORY CLOSES EVERY LOOP.. PLEASE HELP, THIS IS THE CHURCH PROJECT, SO PEOPLE CAN DOWNLOAD CHURCH RECORDINGS...
-----------------------------------------------------------------------------------------
<?php
$dir1 = opendir('../downloads/BBC_Recordings/');
while ($read1 = readdir($dir1)) {
if ($read1!='.' && $read1!='..'){
?>
<div class="container_in">
<h2 class="trigger_in"><h_pan_in><?php echo $read1; ?></h_pan_in></h2>
<div class="toggle_container_in">
<div class="block_in">
<?php
//show files
$myDirectory1 = opendir("../downloads/BBC_Recordings/$read1/");
while($entryName1 = readdir($myDirectory1)) { $dirArray1[] = $entryName1; }
closedir($myDirectory1);
$indexCount1 = count($dirArray1);
sort($dirArray1);
print("<TABLE width='100%' border=0 cellpadding=5 cellspacing=0 class='zebra'>\n");
print("<TR><th></th></TR>\n");
for($index1=0; $index1 < $indexCount1; $index1++) {
if (substr("$dirArray1[$index1]", 0, 1) != "."){
print("<TR><TD><a href=\"../downloads/BBC_Recordings/$read1/$dirArray1[$index1]\" target=\"_blank\">$dirArray1[$index1]</a></td>");
print("</TR> ");
}}
print("</TABLE>\n");
//
?>
</div>
</div>
</div>
<?php
}}
closedir($dir1);
?>
-----------------------------------------------------------------------------------------