xProteuSx Posted November 10, 2011 Share Posted November 10, 2011 I am trying to create a script that alters the navigation div depending on the page the user is on. How do I get the current page using PHP? Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/ Share on other sites More sharing options...
xProteuSx Posted November 10, 2011 Author Share Posted November 10, 2011 Got it: function curPageName() {return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);} Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/#findComment-1287187 Share on other sites More sharing options...
AbraCadaver Posted November 10, 2011 Share Posted November 10, 2011 You can use one of the $_SERVER vars. Try: $_SERVER['REQUEST_URI']; Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/#findComment-1287188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.