[thelist] PHP $SCRIPT_NAME or
Dougal Campbell
dougal at gunters.org
Fri Jan 17 10:31:01 CST 2003
On Fri, 17 Jan 2003, kristina wrote:
> evolters,
>
> Sorry I seem to be on a bit of a list-hogging
> mission at the moment...!
>
> I'm trying to get a little text navigation menu
> working that gets included via php.
>
> I also want it to test and see what page is open
> and unlink that menu item. - So that visitors
> know where they are on the site.
I did this exact thing on my War on Spam site several years ago
(http://spam.gunters.org/)
You can find my navbar code here:
http://pulsar.jb.com/sklar-php/code68.html
I used $REQUEST_URI, which would more properly be
$_SERVER['REQUEST_URI'] in more modern versinos of PHP.
However, using REQUEST_URI could have a drawback, because it will
include any query string information, as well. So if you are using query
strings like 'http://example.com/myscript.php?foo=bar', you'd have to do
additional parsing to strip it out.
In that case, it would probably be easier to just use
$_SERVER['SCRIPT_NAME'] or $_SERVER['PHP_SELF'].
--
Ernest MacDougal Campbell III, MCP+I, MCSE <dougal at gunters.org>
http://dougal.gunters.org/ http://spam.gunters.org/
Web Design & Development: http://www.mentalcollective.com/
This message is guaranteed to be 100% eror frea!
More information about the thelist
mailing list