[ciapug] code: What page am I on?

Chris Hettinger ciapug@cialug.org
Thu, 25 Sep 2003 11:33:10 -0500


See so simple it's stewpid. Thanks Byran.

-----Original Message-----
From: Bryan Baker [mailto:bbaker@iowalaw.org]
Sent: Thursday, September 25, 2003 11:27 AM
To: ciapug@cialug.org
Subject: Re: [ciapug] code: What page am I on?


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.=20
> <?
> // $_SERVER['PHP_SELF'] =3D /directory/directory/page.php
> if ($_SERVER['PHP_SELF'] =3D "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...=20

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. ;-)
--=20
Bryan Baker
Technology Advocate
Iowa Legal Aid
Suite 230
1111 9th Street
Des Moines, Ia 50314-2527

(515) 243-2151 (x1635)

bbaker@iowalaw.org

_______________________________________________
ciapug mailing list
ciapug@cialug.org
http://cialug.org/mailman/listinfo/ciapug


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.'