Hello;
I have a script the reads a directory of mp3s and creates a list of sorted, clickable links. I want to modify it to make is SKIP the first 9 characters when it prints the name ot the links in the list. I do a sort on the first 9 characters so the full name must be in the URL link. Just want to change what SHOWS when it "prints" the list!
I am not very good at coding, so anyone who can help me, I sure would appreciate it!!!
Here is an EXAMPLE of the filename:
"20090222_S2_The Perfect Investment (5 of 7).mp3"
I want it to list the filename as "The Perfect Investment (5 of 7).mp3" when it creates the list. I think it is THIS line - //echo "<a href='$path/$file'>$file</a><br/>";
HERE is the script code NOW:
<?
$path = "mp3/2009/";
$narray=array();
$dir_handle = @opendir($path) or die("Unable to open $path");
$i=0;
while($file = readdir($dir_handle))
{
if(is_dir($file))
{
continue;
}
else if($file != '.' && $file != '..')
{
//echo "<a href='$path/$file'>$file</a><br/>";
$narray[$i]=$file;
$i++;
}
}
rsort($narray);
for($i=0; $i<sizeof($narray); $i++)
{
echo "<a href=".chr(34).$path.$narray[$i].chr(34).">".$narray[$i]."</a><br/>";
}
//closing the directory
closedir($dir_handle);
?>
<h1 style="text-decoration: underline;">2008 Sermons</h1><?
$path = "mp3/2008/";
$narray=array();
$dir_handle = @opendir($path) or die("Unable to open $path");
$i=0;
while($file = readdir($dir_handle))
{
if(is_dir($file))
{
continue;
}
else if($file != '.' && $file != '..')
{
//echo "<a href='$path/$file'>$file</a><br/>";
$narray[$i]=$file;
$i++;
}
}
rsort($narray);
for($i=0; $i<sizeof($narray); $i++)
{
echo "<a href=".chr(34).$path.$narray[$i].chr(34).">".$narray[$i]."</a><br/>";
}
//closing the directory
closedir($dir_handle);
?>