Andy-H Posted November 3, 2008 Share Posted November 3, 2008 Attach the full source code of the file you wish to use the code in please.. Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680852 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 Here are header.php it is included in the index file. and header_image.php it is the file you guys have been helping me snazzle together! Sorry, at this point I feel like i'm kinda being a hassle... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680856 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 <?php $domain = $_SERVER['SERVER_NAME']; echo $domain; ?> Run that code in the page on its own and tell me the result please. pmcsravenstone.com You are sure that wasn't www.pmcsravenstone.com as SERVER_NAME should include the www. also are you including the header_image.php file before the header.php file? Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680859 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 one billion percent! you can do it too! http://pmcsravenstone.com/includes/test.php Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680861 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 SHIT... http://pmcsravenstone.com/includes/test.php http://www.pmcsravenstone.com/includes/test.php Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680863 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 however, this is freakishly interesting, if when I actually make a link with the url and include the www. before the domain it adds it in the php. watch http://www.pmcsravenstone.com/includes/test.php Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680864 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 SHIT... http://pmcsravenstone.com/includes/test.php http://www.pmcsravenstone.com/includes/test.php I love it! I think we were discovering the same thing at the same time! Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680865 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 Do you have an msn addy I can tsalk to you on? I added the gmail one from your profile... Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680869 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 Scrap that then... <?php $domain = $_SERVER['SERVER_NAME']; echo 'Domain: ' . $domain . '<br><br>'; $imgUrl = "http://www.pmcsravenstone.com/media/"; switch ($domain) { case "webdesign.pmcsravenstone.com": $imgUrl .= "web.png"; break; case "dental.pmcsravenstone.com": $imgUrl .= "dental.png"; break; case "family.pmcsravenstone.com": $imgUrl .= "family.png"; break; case "fun.pmcsravenstone.com": $imgUrl .= "fun.png"; break; default: $imgUrl .= "bridge.jpg"; break; } echo 'Url: ' . $imgUrl . '<br>'; ?> Change header_image.php to that and we can find the problem from there... Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680872 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 do diddley, done Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680877 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 So why isnt it echoing the data on the page... Are you including includes/header_image.php on the index.php page? Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680879 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 Do you have an msn addy I can tsalk to you on? I added the gmail one from your profile... yeah, email me or private message me Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680880 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 I mean on Windows Live Messenger. It would be much easier to help you if we could talk in real-time... Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680882 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 yeah I know I was saying to email me or private message me and I would give you my messenger contact, but I went and add your aol messenger name, do you have another? Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680886 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 andy-holland@live.co.uk Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680887 Share on other sites More sharing options...
toothmkr57 Posted November 3, 2008 Author Share Posted November 3, 2008 Ok, so here is the correct code Andy so gratefully fixed up! <?php $domain = $_SERVER['SERVER_NAME']; $parts = explode('.', $domain); if ($parts[0] == "www"){ $parts = array_slice($parts, 1); $url = implode('.', $parts); }else{ $url = $domain; } $imgUrl = "http://www.pmcsravenstone.com/media/"; switch ($url) { case "webdesign.pmcsravenstone.com": $imgUrl .= "web.png"; break; case "dental.pmcsravenstone.com": $imgUrl .= "dental.png"; break; case "family.pmcsravenstone.com": $imgUrl .= "family.png"; break; case "fun.pmcsravenstone.com": $imgUrl .= "fun.png"; break; default: $imgUrl .= "bridge.jpg"; break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680901 Share on other sites More sharing options...
Andy-H Posted November 3, 2008 Share Posted November 3, 2008 Ok, so here is the correct code Andy so gratefully fixed up! <?php $domain = $_SERVER['SERVER_NAME']; $parts = explode('.', $domain); /* splits the string into an array seperated by the dots ie $parts[0] => "www", $parts[1] => "webdesign", etc...*/ if ($parts[0] == "www"){ // check if the first value of parts is "www" $parts = array_slice($parts, 1); // if it is remove the first value $url = implode('.', $parts); /* 'implode' the array values back into a string and add the dots between each value back and set the string to the $url variable..*/ }else{ $url = $domain; // else $domain is ok to use, set it to $url var } $imgUrl = "http://www.pmcsravenstone.com/media/"; switch ($url) // change the switch case to $url instead of $domain. { // the rest all works the same. case "webdesign.pmcsravenstone.com": $imgUrl .= "web.png"; break; case "dental.pmcsravenstone.com": $imgUrl .= "dental.png"; break; case "family.pmcsravenstone.com": $imgUrl .= "family.png"; break; case "fun.pmcsravenstone.com": $imgUrl .= "fun.png"; break; default: $imgUrl .= "bridge.jpg"; break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/130980-solved-wondering-if-i-can-do-this/page/2/#findComment-680907 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.