Help - Search - Members - Calendar
Full Version: [php] Path Question
BleepingComputer.com > Software > Programming
   
Nikas
Hi,

I have problem with this statement.

(dirname($tmp_thispath) == '/')?'./logon':'../logon';

$tmp_thispath refers to /starcom/index.php

does dirname means that get the directory of /starcom/index.php ? which is /starcom

Now, what does this mean > (dirname($tmp_thispath) == '/'). The bold part i not sure what is it referring to.

And what is the differences between ./logon and ../logon?

Anyone can clarify my doubt?




/Nikas
Nikas
Ah... I got it myself.
groovicus
I don't suppose you would care to share your findings for the next person that comes along?
Nikas
Oops!

I'm not sure whether i can explain it correctly. I will try my best.

As $tmp_thispath refers to /starcom/index.php, when i use the function dirname it refers to /starcom folder.

Basically, (dirname($tmp_thispath) == '/') just refers to my URL being http://www.example.com/starcom

For, (dirname($tmp_thispath) == '/')?'./logon':'../logon';

It means, If directory of $tmp_thispath is equal to http://www.example.com/starcom.

The page will be directed to the current directory as shown ./logon and the URL will be http://www.example.com/starcom/logon

else

The page will be directed to the previous directory path as shown ../logon. For example, my URL is currently http://www.example.com/starcom/anything/. It will direct it to http://www.example.com/starcom/logon.

The differences between ./ and ../ is just referring to current or previous directory path.

I hope that i have explained it clearly and understandable.

I'm sorry that i did not state down how i manage to get it at that time, as i was too busy with changing my codes and stuff.

Cheers, smile.gif


/Nikas
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.