$php_self = explode("/", $_SERVER[PHP_SELF]); $url_cnt = count($php_self) - 1; $this_page = $php_self[$url_cnt]; $relative_path = preg_replace("`\/[^/]*\.php$`i", "/", $_SERVER['PHP_SELF']); //echo $relative_path; //echo $this_page; ?>