Finalfantasykid Posted January 14, 2008 Share Posted January 14, 2008 I have a site which has 3 domains, but I want a separate skin for each one. Each domain is sharing the same files and databases, so what I need to do is have some way for my index.php file to see which domain it is at, that way I can change which images and css file the site is using. Or is there another code which does the same thing, like javascript? Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/ Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 I know you could do somthing like: $url = $_SERVER["HTTP_HOST"]; if $url = "mydomain.com"; { echo "poop"; }else{ echo "style1.css"; *CODE NOT TESTED* Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438588 Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 I tested the code above, it does not work do this <?php $url = $_SERVER["HTTP_HOST"]; if ($url == ("lamezz.info")){ echo "style.css"; }else{ if ($url == ("lamezz.com")){ echo "style1.css"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438592 Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 wait, lol do it like this: <?php $url = $_SERVER["HTTP_HOST"]; if ($url == ("domain.com")){ $css = 'style1.css'; }else{ if ($url == ("domain.net")){ $css = 'style.css'; } } ?> <link rel="stylesheet" type="text/css" href="<?php echo $css; ?>"/> Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438596 Share on other sites More sharing options...
Finalfantasykid Posted January 14, 2008 Author Share Posted January 14, 2008 Thanks I think that will work. Now all I have to do is make some skins Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438602 Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 lol glad I could help Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438606 Share on other sites More sharing options...
twostars Posted January 14, 2008 Share Posted January 14, 2008 wait, lol do it like this: <?php $url = $_SERVER["HTTP_HOST"]; switch ($url) { case "domain.com": $css = 'style1.css'; break; case "domain.net"; $css = 'style.css'; break; default: $css = 'style.css'; # I realise that the above and this one are the same, but I'm allowing for more domains. } ?> <link rel="stylesheet" type="text/css" href="<?=$css; ?>"/> Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438635 Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 lol tons better! Quote Link to comment https://forums.phpfreaks.com/topic/85905-solved-accessing-url-informationdomain-name/#findComment-438808 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.