Jump to content

jkies00

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jkies00's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Still nothing.  Would it matter that my $dir variable is coming from an array? [code] $dir = $dirArray[0]; $subFolders = opendir($dir);  $myfile = file('info.txt'); print_r($myfile); [/code]
  2. Hello, I've opened a directory, and I'm trying to read a text file, but I can't get it to read: [code] $subFolders = opendir($dir);  $myfile = "info.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 5); fclose($fh); echo $theData; [/code] The directory I've opened does contain the info.txt file I'm looking for.  I'm able to view it if I list the contents of the folder.  Why can't I read it?  The above code returns no output. ~jeff
  3. why would they be in my array?  i only allowed files of type dir.  does php create a dir for each of those that doesn't show in windows explorer view?
  4. Hello, I noticed something weird - I was able to succesfully create my array, but the first two values in the array are: . .. what are they?
  5. Thanks, Tom - I tried that and it worked. Also got it to work like this: [code]while($entryName = readdir($myDirectory)) { if(filetype($entryName)=="dir"){$dirArray[] = $entryName;} }[/code] ...but I think your way is cleaner.  Thanks!!
  6. Hello, I'm trying to create an array of directories within a specific directory: [code]$myDirectory = opendir("."); //opens directory while($entryName = readdir($myDirectory)) { if(strcmp(filetype($entryName),"dir")==0)){$dirArray[] = $entryName;}  // if the filetype is a directory, add it to the array }[/code] The script works if I take out the if statement, but lists files and folders alike.  I'd like to get a list of only the folders.  What am I doing wrong here?  Any opinions welcome, I'm a n00b.  :o) ~jk
  7. Hi All, I've really been banging my head on the wall with this one. WHen I built my first PHP site a few months ago, I used this little snippet to handle my includes: [code]<?php include($_SERVER["DOCUMENT_ROOT"].'/_includes/components/header.php'); ?>[/code] It worked perfectly - any page in any directory could use the same code to get to the include. Now I have another PHP site to build, so I set up two Virtual Hosts in Apache. Each site now lives in its own directory within the htdocs directory. But now, my nice include code, above, no longer works. The code above resolves to the htdocs directory, instead of the the Virtual Host directory. How can I code my includes to resolve to the root of the Virtual Host directory? Please help! Thanks, ~jeff
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.