AutoChoosing a CSS file based on URL
Posted on
16th Feb 2014 07:03 pm by
admin
Hey everyone,
I have a site that has multiple URLs and CSS files.
Based on the URL that the user goes to I want that CSS file to load.
This is what I have thus far in the <head> of my HTML/PHP file: index.php
Code: <!-- ====================================================== -->
<!-- Which CSS template to use? It depends on the site URL. -->
<!-- ====================================================== -->
<?php $site = $_SERVER['SERVER_NAME']; ?>
<!-- ====================================================== -->
<!-- ============== Harvest Auction Domains =============== -->
<!-- ====================================================== -->
<?php if ($site = "www.agcooponline.com") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.agliberty.com") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.harvestauction.com") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.harvestauction.net") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.harvestauction.org") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.harvestauction.biz") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.harvest2market.com") { ?>
<link href="../templates/tsgcalpha/css/harvestauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<!-- ====================================================== -->
<!-- ============== Hobbies Auction Domains =============== -->
<!-- ====================================================== -->
<?php if ($site = "www.hobbiesauction.com") { ?>
<link href="../templates/tsgcalpha/css/hobbiesauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<!-- ====================================================== -->
<!-- ============== Tools Auction Domains ================= -->
<!-- ====================================================== -->
<?php if ($site = "www.toolsforauction.com") { ?>
<link href="../templates/tsgcalpha/css/toolsforauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.tooleagle.com") { ?>
<link href="../templates/tsgcalpha/css/toolsforauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<?php if ($site = "www.tooltwister.com") { ?>
<link href="../templates/tsgcalpha/css/toolsforauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
<!-- ====================================================== -->
<!-- ============== Aviation Auction Domains ============== -->
<!-- ====================================================== -->
<?php if ($site = "www.aviatorsauction.com") { ?>
<link href="../templates/tsgcalpha/css/aviatorsauction.css" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
</head>
However when I go to any of the URLs it always sees www.aviatorsauction.com.
I have used both $_SERVER['SERVER_NAME']; and $_SERVER['HTTP_HOST'];
Any help would be greatly appreciated.
Thank you
No comments posted yet
Your Answer:
Login to answer
170
40
Other forums
Wrong Info sent Using $get in form
Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls
Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou
Call Screen statement Error
Dear Experts,
is there any setting that needs to be done before creating any dialog progr
Exporting new records
Trying to figure out the best way to set this up.
People register my site.
Their prof
Click counter to ignore traffic from search bots
I have a click counter on my site that...well, counts the number of clicks a link gets on the frontp
Fetching META TAGS through
Hello everybody
I want to fetch meta tags of a domain.
It will be done from following code of
foreach help.
Hello all,
First time I'm attempting to use a foreach statement and was just wondering if my
Parse error: syntax error, unexpected $end in
hello,
i receive the error :Parse error: syntax error, unexpected $end in C:xamppxampphtdocsh
Multi-image upload problems
Lets see if I can get some help on this one. Can anyone show me what I am doing wrong here. I'm just
same querie, or a new one??
Hi guys,
I'm still working on this drop down list. I've got the actual drop down list to wor