I’m stuck! I am somewhat new to PHP and I haven’t been able to solve this problem because it seems that I cannot phrase a google search correctly.
I have a friend with a pizza restaurant that I am helping set up his sites. He has a main site, which we will call http://specialpizza.com. He also has a 12 other different domains, on GoDaddy, that all forward with masking to his main site. The masking basically loads the main site in an iFrame.
Example: http://mainstreetspecialpizza.com forwards to a page with http://specialpizza.com in an iFrame while the URL remains http://mainstreetspecialpizza.com in the browser’s address bar.
When discussing his needs with him, he told me that he wanted all the sites to be basically the same except he wanted each site to reflect the URL in its content.
I figured I could have all 12 domains forward to one page and simply populate the changing site names with variables dependent on the current URL.
I just can’t seem to figure out how to make the variable “$site” have a different value for each URL. I understand that the if/else statement is pretty messed up (single/double quotes and such). I think I am on the right track here but I am not sure.
PLEASE HELP!
EXAMPLE:
[PHP]
//GET CURRENT URL
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;
}
//BEGIN IF ELSE STATEMENT
if (curPageURL() == ‘http://specialpizza.com/’) {
echo "$site=‘Special Pizza’ ";
} if (curPageURL() == ‘http://mainstreetspecialpizza.com/’) {
echo "$site= ‘Main Street Pizza’ ";
if (curPageURL() == ‘http://elmstreetspecialpizza.com/’) {
echo "$site= ‘Elm Street Pizza’ ";
} else{
echo ‘doesnt work’;
}
?>
Welcome to <?php echo $site; ?>
Text text text <?php echo $site; ?> text text text text text text text text text text text text <?php echo $site; ?> text text text text text text
[/PHP]