Malkavbug Posted April 6, 2006 Share Posted April 6, 2006 Here is the issue in a nutshell. I know how to use $_GET to pull variables (&var=1) in URLs, but I was wondering about using it, or an alternative, to pull the actual URL.Here is the breakdown. I have a leftbar that is being pulled as an include, and I want the contents to change based on the page they are on in my site. So the value is different at page1.php and page2.php rather than ?page=1Can $_GET do this? Is there another command that can? Link to comment https://forums.phpfreaks.com/topic/6740-_get-to-name-of-php-file/ Share on other sites More sharing options...
trq Posted April 6, 2006 Share Posted April 6, 2006 Look up the $_SERVER array. In particular $_SERVER['PHP_SELF']. Link to comment https://forums.phpfreaks.com/topic/6740-_get-to-name-of-php-file/#findComment-24510 Share on other sites More sharing options...
Malkavbug Posted April 6, 2006 Author Share Posted April 6, 2006 ahhh okay, so it would be like if $_SERVER['PHP_SELF'] == [a href=\"http://www.site.com/php.php\" target=\"_blank\"]http://www.site.com/php.php[/a]HmmmmAhhh okay, what I was looking for was $_SERVER['REQUEST_URI']; since that only returns the base file nameIn this case /about.php?view=vitals or /about.php for the base page.About to test it out and see how it flys. I might have some questions involving wildcards in a bit since I will need to get /about.php?view=vitals and /about.php results to act the same. Link to comment https://forums.phpfreaks.com/topic/6740-_get-to-name-of-php-file/#findComment-24519 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.