CSS / 3 columns / header / footer
no javascript, no table
no javascript, no table
This technique is interesting for a lot of values to modify.
For a few values, a method similar to the one described for cookies should be better.
In each page we get the variable value in $choiceofstyle and we send it to the CSS/PHP file fixe3col.php.
<?php $choice=""; if(isset($_GET["style"])) { $choiceofstyle=$_GET["style"]; $choice="?style=$choiceofstyle"; } ?> <style type="text/css"> @import "fixe3col.php<?php echo $choice?>"; </style>
For the style 1, The link that will allow the style switching will be:
<a href="nameofpage.php?style=1">style 1</a>
We set all the default values -here for the text and background of body- and the values to set when a variable is sent to the CSS/PHP file.
<?php header("Content-type: text/css; charset=iso-8859-1"); header("Cache-Control: must-revalidate"); $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"; header($ExpStr); /*default values*/ $textcolor="#0A00B0"; $backgroundcolor="#E9F5FE"; if(isset($_GET["style"])) { switch ($_GET["style"]) { case "1" : $textcolor="#FDC990"; $backgroundcolor="#908E53"; break; case "2" : $textcolor="#908E53"; $backgroundcolor="#FDC990"; break; /*etc*/ } ?> body{ color:<?php echo $textcolor?>; background-color:<?php echo $backgroundcolor?>; } /*etc*/
As soon as a variable is sent, the style sheet will be modified accordingly and the browser will apply the styles as it does for this page.
This page doesn't use any hack for the layout or menu.
Conditional comments have been added for MSIE.
Back to the example page.