More about Directories.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

More about Directories.

Post by JellyFish »

The opendir() function has an argument which should be the directory in which you want to open. What I want to know is, what's a directory consist of?

For example, my understanding of a directory was always: http://www.google.com, file:///C:/My Documents/, etc. But when I come across this function, it's demanding something like: /home/www/whatever.com/, and such.

So what I want to understand is this: /home/www/whatever.com/. I would like to know what makes a directory in this case???

Thanks for reading.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Neither of your first two examples are directories, but URLs. The first being an internet site and the second being a directive to your local file system.

A directory, or folder as Windows (and some Macs) call them, is a container. Differing operating systems use differing marks to distinguish between directories and files. For instance, some use "/", while others use "\" a few even use ":". They are just a means to storing data in a structured way as we like our structure, while the computer doesn't really care too much.

C:\Windows is a directory (or folder) for example.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

I see. So they're URLs. But what my question is, how do I know what to give as an argument for opendir() function? I don't know what the directory for my web site looks like, only it's URL. You know what I trying to say?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER['DOCUMENT_ROOT'] may be of interest.

so may the return from dirname(__FILE__)
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

Thanks feyd. But is there an artical on what home in /home/www/mysite.com/ means? And the www in it aswell, etc? Also is there a way to access a directory from another server? Like say I want one site to get something from another?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

They don't actually mean much of anything; they're just directories. There are some common directories used on various flavors of *nix, but in general you don't need to worry about them.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

There are some common directories used on various flavors of *nix, but in general you don't need to worry about them.
That I don't understand. But what I do understand now, is that my question has evolved into:

How do I access another directory? e.g. Use the opendir() function and apply an directory from another server as it's argument.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

opendir() last I checked, cannot open another server's directories.
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

Then how could I accoplish this, if not even with php?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why not explain what you're trying to do?
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

I'm trying to display files and folders from another server.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Post Reply