Jump to content

Archived

This topic is now archived and is closed to further replies.

Lessur

if page = something.php

Recommended Posts

How can I make a code like:

<?php if $page == 'blah.php'; {

echo "blah";}

else{

echo "blahblah"; }

?>

Where $page = the page.  Like if you were at login.php wit would be login.php.

How can I tell it that $page = the filename of the page?

Share this post


Link to post
Share on other sites
There is a variable called $_SERVER['PHP_SELF'] that gets the current script location.  Be warned, this will return very strange results on shared hosting.  It gives something completely off base on my shared hosting.

EDIT: What does 'basename' do?
EDIT EDIT: php.net/basename shed some light on this, it fixes the problem I mentioned.  Silly me.  Sorry about that.

Share this post


Link to post
Share on other sites
basename returns the filename component of a path
http://us2.php.net/manual/en/function.basename.php

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.