Use:
//function curPageName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
echo "This page name is ".curPageName();
?>//
This will give you just page.html etc..
Saturday, August 7, 2010
Current Page Name in PHP
Paste this code anywhere on your page or include:
//function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>//
Then you can output the current page name using:
// echo curPageURL();
?>//
Simple and easy, and a great little piece of code!
note**** remove the "//"
//function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>//
Then you can output the current page name using:
// echo curPageURL();
?>//
Simple and easy, and a great little piece of code!
note**** remove the "//"
Wednesday, February 11, 2009
Transparent Flash Banner ads, or flash animations
This is a question that comes up quite often. You see them all the time on sites like imdb.com or cnn.com - A flash file when rolled over with mouse activates into a larger banner. They are actually pretty annoying, but I must say usually are some of the most creative banner ads I see around.
I have found a nice easy transparent flash banner ad tutorial here for you:
http://www.webdesign.org/web/flash/tutorials/change-flash-size-at-run-time.7633.html
Unfortunately this is done in a flash ( like ) program. If there is a demand, I can post a tutorial on doing this in Adobe Flash.
I have found a nice easy transparent flash banner ad tutorial here for you:
http://www.webdesign.org/web/flash/tutorials/change-flash-size-at-run-time.7633.html
Unfortunately this is done in a flash ( like ) program. If there is a demand, I can post a tutorial on doing this in Adobe Flash.
Break up XML feeds using php - Tutorial
A lot of people seem to ask how to do this. A client asked me once for a similar solution, and once I researched a little about this, I found it was quite simple to do. I will explain more in a full tutorial soon.
Labels:
break up feeds,
break up rss,
feeds,
php,
rss,
sql,
xml
Friday, January 30, 2009
Space in above dhtml menu in firefox
One day I all of a sudden noticed my website was not displaying correctly, I had spaces above images, and spaces above my dhtml drop down menu. I spent a little time trying to find the answer by searching Google, and eventual found my solution.
Just place this into your css file:
object { display:block; }
or if you do not have a css file, use :
in between the head tags of course :)
Eric's Tip #1
Just place this into your css file:
object { display:block; }
or if you do not have a css file, use :
in between the head tags of course :)
Eric's Tip #1
Subscribe to:
Posts (Atom)