[SOLVED] need help with URLs

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
LegoBoy
Forum Newbie
Posts: 9
Joined: Fri Jul 16, 2004 4:02 pm

[SOLVED] need help with URLs

Post by LegoBoy »

1st, is there a function to return the current file URL you are viewing?

2nd, is there any way I can make an include with (I hope this the proper term) absolute path? EG: include("/someFile.php");
Last edited by LegoBoy on Tue Aug 03, 2004 2:31 pm, edited 1 time in total.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

1) Yes.

Code: Select all

$_SERVER['PATH_TRANSLATED'];
2) Yes you do it as your doing. Just play around with trying to include files and look at your results.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

__FILE__ also works nicely for the absolute file you are in.. (not necessarily the script you are executing)
User avatar
LegoBoy
Forum Newbie
Posts: 9
Joined: Fri Jul 16, 2004 4:02 pm

Post by LegoBoy »

Ok. Thanks for the help. Now that I know about the $_SERVER array I'm using [PHP_SELF], [REQUEST_URI], and [HTTP_HOST]
Post Reply