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 Like 40 Dislike
Previous forums Next forums
Other forums

Mouseover to edit (Ajax)
hi friends, can anyone help with the code behind to get this application working, please in VB (new

Storing/displaying image urls in a database?
Hi
Basically I have the following scenario:
User chooses picture from list. Picture info is ad

Fatal error: Call to a member function fetchrow() on a non-object in C:xamppht
okay i have this query and everytime i add `item_id`=? to it... it gives me the error in the title..

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

Mail functionality from localhost to server
Hi

I am facing problem of mail functionality.

When i tested mail functionality in my

Effort Estimation Template for Steady State Support
Hi Everyone,

Is there any SAP provided template/format for system change and enhancements

Comment Mod System Effects all rows...
Sorry if its confusing but here is whats going on: I have a table in a database called comments and

i have no idea why this isn't working
Code: <?php
session_start();
include("connect.php");

error_reporting(E

Preg_match with an array
is there an away to use preg_match with an array?

i want to check a string with an array to s

help connecting a form to php and then emailing the form
Ok. So, I made a form, and I need help to where when submitted, I get an email with the submitted de

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash