On Thu, 2008-02-07 at 12:30 -0600, Steve Marquez wrote: > Could someone please point me in the right direction? I am trying to have > PHP find out if a directory has files in it and then if it does, display and > include, if it does not, then not display the include. oooh, goodie! You get to play with my new favourite toys - SPL! Try this: public function lsDir($dir, $type='files') { $iterator = new RecursiveDirectoryIterator($dir); foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { if ($file->isDir()) { $dirs[] = $file->getPathname(); } else { $files[] = $file->getPathname(); } } if($type = 'files') { return $files; } else { return $dirs; } } (untested - written from mind dump - so please test 1st) Then, AFAIK SPL also has an __autoload that you can use. > I have looked at the Manual and did not really know where to look. > http://www.php.net/spl --Paul -- ------------------------------------------------------------. | Chisimba PHP5 Framework - http://avoir.uwc.ac.za | :------------------------------------------------------------:
All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php