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
How to insert random unique values in 2 columns ?
I have table with 2 columns
Create Table code_for_code (
first_code varchar2(10) uni
RadioButtonList data selection
view plaincopy to clipboardprint?count only commas outside parenteses
I have a sql table containing
id - query - query name
the first page contains a drop down men
PHP page is blank
Hi Everyone,
I have a site in which I am able to open the first PHP webpage in my browser but
Paypal
Hi all,
I have an advanced basic knowledge of php
I want to try something new for a s
storing results of a function - previous result overwritten with new result
I have created a function to validate input.
function validate_dimension($value,$name) {
<
Company Code for Vendors created through Business Partners
Hi, experts!
I'm trying to set up the integration between Business Partner (BP) and Vendo
disable all input buttons
Hello Friends,
suppose i do have a file ( file.php ) has a submit button
Code: [Sele
Inserting 100x and 100y coordinates in mysql table - easy
Is there a way to insert this data into a mysql table named 'map' with the fields: 'x int 3' , 'y in
unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_
Can anyone view my code and tell me why im getting the error:
Parse error: syntax error, unexpect