Hi, i'm new to all this so all help recieved is appreciated. I want to create a simple colour scheme which enables me to select different CSS. Ie I have a header at the top of my page and a simple white background. I have some squares Red, Green Blue which act as my colour scheme. When clicked these will call the relevant CSS files and change the background colour and header colour. As this is a Uni project i cannot use any IDE'S it has to be purely word processor created. How do i do this,? Gary
You could write some php within the style sheet link. And use some get methods to get the values. Something like this and the links would be index.php?color=red index.php?color=blue index.php?color=yellow index.php?color=green <?php $color = $_GET['color']; if(!$_GET['color']) { echo '<link rel="stylesheet" type="text/css" href="normal.css" />'; }elseif($color=="red") { echo '<link rel="stylesheet" type="text/css" href="red.css" />'; }elseif($color=="green") { echo '<link rel="stylesheet" type="text/css" href="green.css" />'; }elseif($color=="blue") { echo '<link rel="stylesheet" type="text/css" href="green.css" />'; }elseif($color=="yellow") { echo '<link rel="stylesheet" type="text/css" href="yellow.css" />'; } ?> PHP: There are many different ways you can do it, this is just something i made quick on the quick reply, havent tested it but should be fine. Glen
As this is a Uni project, you should be submitting your own work... Here is a hint: <style type="text/css"> #header { background-color: <?php echo $_GET['color']; ?>; } </style> Code (markup):
The code would go in the head tags in your web page. Make sure it has a .php extension. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="clantemplates2, free templates, clan templates, free clan cms, cms clan, glen hughes, ct2, multigaming site, free, clan, templates, free clan templates" /> <meta name="Description" content="Clantemplates2.com offers gaming clans free templates, and the option to use the free clan cms." /> <title>Clantemplates2.com - Free Clan Gaming Templates and a CMS</title> [B]<link href="style.css" rel="stylesheet" type="text/css" />[/B] <script type="text/javascript" src="flash_flv_player/swfobject.js"></script> <script type="text/javascript" src="highslide/highslide.js"></script> </head> HTML: See where I have highlighted in bold that would be where the php would go, you can use krt's code but someone could play around with that and make it mess the page. So make your style sheets for your colours. Then in the styles have your normal styles in them all and in the body section like this. body { background:red; } Code (markup): Hope you get what I mean.
My code was a starting point, a "hint". You could use a colour name to hex conversion and a default value for invalid colours etc. Besides, someone can mess the layout of any page (and very easily with EditCSS or Firebug, extensions for Firefox). But they would probably have to do it deliberately so it is their own problem! And so much for not effectively doing the assignment for him