What server are you running on?  In Apache, if you add any filename to the
DirectoryIndex line, it will display that page from any directory without
specifying the filename.  It comes default with pages like index.htm,
index.html and index.shtml.  If you add, for instance, index.php (some
distros have this by default, as well), then you can have it load that page
by default with no file listed on the address/location bar in our browser.


"Dr.Bob" <[EMAIL PROTECTED]> wrote in message
I'm trying to figure out how www.devshed.com does what I want to achieve
also, this is my point:

my main URL (for example) is www.mycompany.com
I want the central page about our projects to be found under
and project LovePeaceAndBananas under

I already know that this can be achieved by using the $PATH_INFO as
variables, to be used in de main file in the root of the site.
So far I have my Apache webserver accept files with no extention (index, in
stead of index.php) to be parsed as PHP. But if I look at the site of
DevShed, I don't see them using a file at all! I can't get it to work on my
local test system to make an URL like
www.mycompany.com/projects/LovePeaceAndBananas without the existens of a
file called 'projects'.
Can anyone tell me their 'trick'? (unfortunately, they don't show their page
source anymore like they used to do ...)

Also, when I try to extract the variabeles from the $PATH_INFO I get some
errors depending whether or not I end with a slash, and I do want to make
this fool prove, so that when a site visitor deletes the slash at the end,
it doesn't result in an error.

This is the code I made:
$var_array = explode("/",$PATH_INFO);
$words = array_unique ($var_array);
$total = count($words);
for ($i = 0; $i <= $total; $i++) {
    echo "variable " . $i . " = " . $var_array[$i]."<br>";

And when I call this file (localhost/index) like this:

This is my output:
variable 0 =
variable 1 = one
variable 2 = two
variable 3 = three
variable 4 =

Ofcourse I don't need the variable 0 and 4, can someone tell me where they
come from?
And, as said above, I get an Undefined Ofset-warning when I don't have a
closing slash at the end, how can I protect this?

Phew -- a lotta lotta questions here, hope someone can help me to climb this
Thanx in advance!

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to