Steve Marquez wrote:
Greetings,
Could someone please point me in the right direction?
Turn left at the next light...
I am trying to have
PHP find out if a directory has files in it and then if it does, display
Display what? The directory name, or the list of files?
and include,
What do you mean by include? the include command from PHP?
if it does not, then not display the include.
Again, what do you mean exactly?
I have looked at the Manual and did not really know where to look.
Which part of the manual did you look at?
Here are a few parts of the manual that I would start with.
This will get you a complete list of files, directories, etc... in a given directory
http://us2.php.net/manual/en/function.glob.php
This class allows you retrieve and iterate through a directory listing.
http://us2.php.net/manual/en/class.dir.php
Between the above two options, I recommend glob()
Now loop through the results with foreach or while .
http://us3.php.net/manual/en/control-structures.foreach.php
http://us3.php.net/manual/en/control-structures.while.php
run the following two commands on each value of the given array to determine
whether the given entry is a file, directory, or something else
This will allow you to determine if something is a file
http://us2.php.net/manual/en/function.is-file.php
This will allow you to determine if something is a directory
http://us2.php.net/manual/en/function.is-dir.php
if you found a directory, use this to change to that directory and start the
process all over again.
This will allow you to change your current working directory to a new directory
http://us2.php.net/manual/en/function.chdir.php
Hope these help
Thanks,
--
Steve M.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php