Screencast 1 – mod_rewrite and PHP
Screencast – mod_rewrite and PHP from José Airosa on Vimeo.
Hello folks!
This time, and for the first time, I bring you a screencast! It’s all about mod_rewrite and PHP. What it is, how can we use it and how can we integrate it to be used with PHP.
Below are the functions that i talked about in the screencast. Use them, or not, as you please.
/**
* Get current page URL
*
* @return string with paeg name
*/
function curPageURL() {
$pageURL = 'http';
if (isset($_SERVER["HTTPS"]) && $_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;
}
/**
* Get current page script name
*
* @return string with page script name
*/
function curPageScriptName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
/**
* Get current page name
*
* @return string with page script name
*/
function curPageName() {
return end(explode("/",curPageURL()));
}
Hope you’ll enjoy as much as I did making it
Let me know your feedback.