| 
	
 | 
 Posted by Bimperial on 02/05/07 06:21 
Just another newb here in need of a little help....and probably some 
sleep as well ;) I'm just getting started with PHP reading all I can 
get my hands on, on and off line. I have simple bit of code that 
displays a list of mp3 files from a different directory from which the 
script runs in..... 
 
<table align=CENTER bgcolor=#ffffff cellpadding=4 cellspacing=0 
border=2> 
<tr><th>Song Title</th></tr> 
<?php 
$dir = "../songs/"; 
 
// Open a known directory, and proceed to read its contents 
if (is_dir($dir)) { 
   if ($dh = opendir($dir)) { 
       while (($file = readdir($dh)) !== false) { 
           echo "<tr><td> <a href=\"$dir\">$file</a>  "."</td></tr>"; 
       } 
       closedir($dh); 
   } 
} 
?> 
 
the display is fine, I'm just pulling my hair out trying to get the 
link to the individual files set correctly, but alas everything I've 
tried so far bombs out. I do not know how to add the file name along 
with the directory in the href ;( 
Can somebody set me straight please......? Then I'll go to bed ;) TIA 
 
Bewildered Bob
 
  
Navigation:
[Reply to this message] 
 |