IDTstudios1
Programmer
The following script keeps puting dots before the actual directory. Basically it outputs:
<a>.</a><br><a>..</a><br><a>testone</a><br><a>testtwo</a>
when it should output:
<a>testone</a><br><a>testtwo</a>
Script:
$dir = "albums/";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false) //while files and folders are being read
{
if (filetype($dir . $file) == dir) //if the filetype is a directory and not a file
{
echo '<a>' . $file .'</a><br>';
}
}
closedir($dh);
}
}
Any help would be great,
Thanks
<a>.</a><br><a>..</a><br><a>testone</a><br><a>testtwo</a>
when it should output:
<a>testone</a><br><a>testtwo</a>
Script:
$dir = "albums/";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false) //while files and folders are being read
{
if (filetype($dir . $file) == dir) //if the filetype is a directory and not a file
{
echo '<a>' . $file .'</a><br>';
}
}
closedir($dh);
}
}
Any help would be great,
Thanks