I forgot about that value++ variable that was to debug.
So this is my code now:
PHP Code:
<?php
if ($handle = opendir('./images')) {
while (false !== ($file = readdir($handle))) {
if (is_dir($file)) {
if (substr($file, 0, 1) != ".") {
?>
<a href="<?php echo $file; ?>"><?php echo $file; ?></a><br />
<?php
}
}
}
closedir($handle);
}
This is the output from this:
HTML Code:
<a href="fraser">fraser</a><br />
My debug code is:
PHP Code:
<?php
$value = 0;
if ($handle = opendir('./images')) {
while (false !== ($file = readdir($handle))) {
echo "#" . $value . " " . $file . "<br />\n";
if (is_dir($file)) {
if (substr($file, 0, 1) != ".") {
?>
<a href="<?php echo $file; ?>"><?php echo $file; ?></a><br />
<?php
}
}
$value++;
}
closedir($handle);
}
?>
and the output is
HTML Code:
#0 fraser<br />
<a href="fraser">fraser</a><br />
#1 icons<br />
#2 hogan<br />
#3 admin<br />
#4 ..<br />
#5 .<br />
#6 original<br />
#7 loading.gif<br />
#8 chris<br />
I also tried adding a file into the hogan directory but that didn't get it to show up so it's not that the direcotry needs content.
Bookmarks