sachavdk Posted January 19, 2007 Share Posted January 19, 2007 Hi,I'm trying to write a function that loops through a folder I specify,if a specific file is also a folder, the function itself is called again with the new directory path,it loops through this one, ...But the error I get is:[b]The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:[/b](No headers are sent with it).Here's the function (var $tpls is not used yet but I don't think that'll be the problem):[b]$tpls = "";$dir = "styles/main/tpl/";function loopDirs($dir, $tpls) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (is_dir($dir . "/" . $file . "/")) { loopDirs($dir . "/" . $file . "/", $tpls); } else { echo $dir . "/" . $file."<br />"; } } closedir($dh); } }}loopDirs($dir, $tpls);[/b] Quote Link to comment Share on other sites More sharing options...
sachavdk Posted January 19, 2007 Author Share Posted January 19, 2007 Sorry for posting that quick, I had to search better.The error is caused because I don't check for . and ..So it gets in an never ending loop.Maybe something to check for people who have the same prob. :P ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.