Re: [PHP3] directory function use problem

From: Date: Wed, 14 Jun 2000 00:19:27 +0000
Subject: Re: [PHP3] directory function use problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1783@lists.php.net to get a copy of this message
In article <002401bfcf4c$d3b4aa40$7500bdd8@taox>, brianh@rjsonline.net ("TaoX { Brian Hinson; }") wrote: I dunno what's going wrong, but: echo out your variables as you go and see what you're actually getting. Also use "View Source" to see what HTML you're generating. > I've worked on this for three days, here goes... > > I want to get the list of directories/folders from a specific directory and > turn them into html anchor links... I have a currentDir form variable and > previousDir form variable. > > the start up code for the page is > <?php > if(!isset($currentDir)) > { > $currentDir = dirname($PATH_TRANSLATED); > $previousDir = dirname($PATH_TRANSLATED); > } > ?> > > this stores the current full path into the vars(if they don't already > exist!) > > > here is the function that does the real work... and also has the problem > > function sideBar() > { > displaySubscribe(); > > // create a dir object instance... > $dirList = dir(stripslashes($GLOBALS['currentDir'])); > > // read each dir entry in, only getting the directories, no files and > neither . or .. directories. > while($entry = $dirList->read()) > { > if(is_dir($entry) && $entry != "." && $entry != "..") > { > $working = stripslashes($GLOBALS['currentDir'])."\\".$entry; // > create > the new path > echo "<a href=\"index.php3?currentDir=$working\">$entry</a> > <br>"; > } > } > $dirList->close(); > } > > Ok now when you click the link... it set currentDir correctly, but when this > function is called again after clicking a directory that is now an anchor it > doesn't display the directories inside that one? > > help... I'm sure it has something to do with the whole \\ vs \ thing... > > TaoX -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#1783) next »