News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Capture php file name

Started by CokeCan, November 10, 2003, 02:01:28 PM

Previous topic - Next topic

CokeCan

Hi!
I need to capture the file name that the user is in, for example if the user is at: www.mysite.com/welcome.php it must show "welcome.php"
Does anybody can help me? ;)
Thanks in advanced! :D

Spaceman-Spiff

use $_SERVER["SCRIPT_NAME"] or $_SERVER["PHP_SELF"]
you'll still need to parse it though

CokeCan

Thanks for your answer!
I need something like $_SERVER["PHP_SELF"] but the problem is that it shows the whole directory. Is it posible to show just the file? :)

Tyris

you could strip of everything before the last slash... that'd work wouldnt it...?
alternatively... you can include a $thisfile variable in each file with its name ;)

[Unknown]

The basename function is your friend.

-[Unknown]

Tyris

whoa... never heard of that function (like so many others), but thats really useful ^_^

CokeCan

Thanks guys!!!! :D
That's what I need ;)

Advertisement: