Uh; I've been tasked with the monumental task of making a website more dynamic and useful; one of the things I'm required to do is create a php script that will read the contents of a subdirectory, so we can simply plonk reports and papers and whatnot in the subdir and have them viewable.
Currently, I've only got as far as listing the
current directory - the one the script resides in.
//code begins
$getdir = dir(".");
print("<UL style='text-align: left;'>\n");
while($entry = $getdir->read())
{
if ($entry!= "." && $entry!= ".." && $entry!= "index.php" && $entry!= "default.php")
{ print("<LI><a href=$entry>$entry \n</a>"); }
}
this is the code I'm using, it was shamelessly tea-leafed from some php site, though I can't find it again. Anyway, the PHP manual seems to imply that I can set
dir("/etc"); and have it list the contents of that tree, but doing so brings up:
Fatal error: Call to a member function on a non-object in path to htdocs/user on line 25. [25 in the fully formatted script is the
while statement]
Can anyone begin to shed some light on it? (should I be using readdir? etc)
Cheers.