Travellingman Posted July 12, 2008 Share Posted July 12, 2008 Hi all. New here. From Sweden so excuse my bad grammar. :-X Can someone please help me with this script? You send in: example: '/about' or '/service' or an empty string: It matches from the URL and if it finds it it returns true. Now I would very much like it to work out if Im in the root folder or not, if you send in an empty string. function isurlcurrentpage($url = "") if ($url != "") { if(strpos($_SERVER['PHP_SELF'], $url) == false) { return false; }else{ return true; } }else{ // PSEUDOCODE // Nothing has been sent in. Shall we return true or false? // [b]If this script is called from a page in the rootfolder - Return true.[/b] Example: 'domain.com/somewhere.php' return true; // [b]Is called from a subcatalog? - Return false[/b] Example: 'domain.com/about' return false; } } A little help please? Link to comment https://forums.phpfreaks.com/topic/114440-script-called-from-root-or-from-a-subfolder/ Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 Instead of using PHP_SELF use REQUEST_URI to get the full url. Link to comment https://forums.phpfreaks.com/topic/114440-script-called-from-root-or-from-a-subfolder/#findComment-588697 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.