I am trying to use a stylesheet switcher as discussed at A List Apart PHP Switcher but i cant get it to work.
I wondered if anyone would mind having a look and seeing if they can work out whats wrong.
‹ ? php
session_start();
? >
‹ ? php
if(isset($_GET['css'])){
switch ($_GET['css']) {
case 'mhwell2':
$stylesheet = '<link href="mhwell2.css" type="text/css" rel="stylesheet"›'; $_SESSION['csschanger']=$stylesheet; break; default: $stylesheet = '‹link href="mhwell1.css" type="text/css" rel="stylesheet"›'; $_SESSION['csschanger']=$stylesheet; } } ? › In the header of the php/xhtml file i have: ‹? php echo ($_SESSION['csschanger'])? $_SESSION['csschanger']: '‹link href="mhwell1.css" type="text/css" rel="stylesheet"›' ;?› and i use links to change the style sheet with the following code: Select ‹A href=" ‹?php echo $_SERVER['PHP_SELF']; ?>?css=mhwell2"›[leaves]‹/a› or ‹A href="‹?php echo $_SERVER['PHP_SELF']; ?>?css=default"›[sunflower]‹/a› I really dont know php at all which is why i've borrowed a script so please dont baffle me with technospeak. The reason I want to use php rather than javascript is because of accessibility and backwards compatibility.
I wondered if anyone would mind having a look and seeing if they can work out whats wrong.
‹ ? php
session_start();
? >
‹ ? php
if(isset($_GET['css'])){
switch ($_GET['css']) {
case 'mhwell2':
$stylesheet = '<link href="mhwell2.css" type="text/css" rel="stylesheet"›'; $_SESSION['csschanger']=$stylesheet; break; default: $stylesheet = '‹link href="mhwell1.css" type="text/css" rel="stylesheet"›'; $_SESSION['csschanger']=$stylesheet; } } ? › In the header of the php/xhtml file i have: ‹? php echo ($_SESSION['csschanger'])? $_SESSION['csschanger']: '‹link href="mhwell1.css" type="text/css" rel="stylesheet"›' ;?› and i use links to change the style sheet with the following code: Select ‹A href=" ‹?php echo $_SERVER['PHP_SELF']; ?>?css=mhwell2"›[leaves]‹/a› or ‹A href="‹?php echo $_SERVER['PHP_SELF']; ?>?css=default"›[sunflower]‹/a› I really dont know php at all which is why i've borrowed a script so please dont baffle me with technospeak. The reason I want to use php rather than javascript is because of accessibility and backwards compatibility.
