CSS Style Switching
-
I apologize for starting a new thread, but I realized that where I posted before was marked [resolved]. I’m trying to use the A List Apart method of switching.
I can’t get this method to work to save my life. I’ve tried several different suggested methods of implementing this without success. In the process, I’ve now confused myself!
I have:
Sidebar
′
<form action=”wp-content/themes/crisp/switcher.php” method=”post”>
<select name=”set”>
<option value=”style”> ? Spring</option>
<option value=”Pegasus” selected=”selected”> ? Pegasus</option>
</select>
<input type=”submit” value=”Change Style”>
</form>′
Switcher.php
′
<?php
if (isset($_POST[‘set’]))
{
setcookie (‘style’, $_POST[‘set’], time()+31536000, ‘/’, ‘dreamwhisperdesigns.com’, ‘0’);
header(“location: ” . $_SERVER[‘HTTP_REFERER’]);
}
?>
′header.php
′
<link rel=”stylesheet” type=”text/css” media=”screen” title=”Pegasus” href=”<?php bloginfo(‘template_directory’); ?>/<?php echo (!$_COOKIE[‘style’])?’Pegasus’:$_COOKIE[‘style’] ?>.css” />
<link rel=”stylesheet” type=”text/css” media=”screen” title=”Spring” href=”<?php bloginfo(‘template_directory’); ?>/style.css” />′
I’ve tried everything – full urls, different combinations, etc.
′
<link rel=”stylesheet” type=”text/css” media=”screen” title=”Spring” href=”<?php echo (!$_COOKIE[‘sitestyle’])?’style’:$_COOKIE[‘sitestyle’] ?>.css” />
′
What am I missing?
- The topic ‘CSS Style Switching’ is closed to new replies.