[ciapug] code: What page am I on?
Bryan Baker
ciapug@cialug.org
Thu, 25 Sep 2003 11:27:10 -0500
Chris Hettinger wrote:
> I'm struggling with something that is probably pretty easy.
> URL: www.somedomain.com/directory/directory/page.php
> In my script I want to determine if I am on a specific page, then I show some thing different.
> <?
> // $_SERVER['PHP_SELF'] = /directory/directory/page.php
> if ($_SERVER['PHP_SELF'] = "page.php"){
> echo "You are on page.php";
> }
> ?>
> How do I approach cutting $_SERVER['PHP_SELF'] down to page.php.
> I considered using: explode("/",$_SERVER['PHP_SELF']);
> Or by finding the last (right most) "/" and then taking the rest of the string as the file name...
try:
echo (basename($_SERVER['PHP_SELF']));
> CONFIDENTIALITY NOTICE: This communication, including any attachment, may contain confidential information and is intended only for the individual or entity to whom it is addressed. Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email, delete and destroy all copies of the original message.'
I know it's an auto-sig, but those are just silly on mailing lists. ;-)
--
Bryan Baker
Technology Advocate
Iowa Legal Aid
Suite 230
1111 9th Street
Des Moines, Ia 50314-2527
(515) 243-2151 (x1635)
bbaker@iowalaw.org