Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-12-2005, 01:36 PM   PM User | #1
sammahoney
New to the CF scene

 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sammahoney is an unknown quantity at this point
Random Stylesheet Type question

Hi Guys

I'm working on my companies website at the moment. I've been making sites for a while, but I've never gotten into CSS style sheets or any real coding stuff. Basically, I want to have maybe 3 different coloured versions of the site, with a different picture for each, and have it so that when you visit the site you randomly see one of the 3. They'll be identical apart from the colour scheme and picture. You can view the site here:

http://free-st.t-com.hr/nfje/aps/

If anyone knows how to code a simple index.htm page that will randomly direct you to, say, index_green.htm, index_red.htm or index_blue.htm I'd be forever grateful. I've read on some of the posts here that CSS is the way to go but I really haven't a clue where to start.

Cheers

Sam
sammahoney is offline   Reply With Quote
Old 12-12-2005, 01:54 PM   PM User | #2
quasar
New to the CF scene

 
Join Date: Dec 2005
Location: Rotherham, UK
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
quasar is an unknown quantity at this point
Are you able to use PHP on your server?

If so, you could solve the problem through a little PHP command.

PHP Code:
<?php

$css 
rand(02);

if(
$css === 0){
  echo 
'<link rel="stylesheet" type="text/css" href="/sylesheet1.css" />';
}

elseif(
$css === 1){
  echo 
'<link rel="stylesheet" type="text/css" href="/sylesheet2.css" />';
}

else{
  echo 
'<link rel="stylesheet" type="text/css" href="/sylesheet1.css" />';
}

?>
Replace the 'href' bit with a link to whatever stylesheet you are using and place the above code inside the <head> tags of your website.

I hope that works, it seemed to when I tested it.

PS Sorry if that shouldn't have been posted in this forum.
__________________
Matt
http://www.quasar-host.net/
quasar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:23 AM.


Advertisement
Log in to turn off these ads.