Hi all
I am trying to implement a change into my site without the use of javascript that allows the user to click a link which will change the stylesheet for the entire site, but it is not working and I need help in finding out why!
Here is my PHP script that creates a cookie. I call this script via a simple hyperlink on my web page.
setcookie ('sitestyle', 'newstylesheet', time()+31536000, '/', 'mydomain.com, '0');
header("Location: $HTTP_REFERER");
This simply creates a cookie and sets its value to be the name of the alternative stylesheet. In this case it is called 'newstylesheet'.
In my <HEAD> tags of my website, I have this code:
<link rel="stylesheet" type="text/css" media="screen" title="User Defined Style" href="/<?php echo (!$sitestyle) ? 'defaultstyle' : $sitestyle ?>.css" />
Which should detect if my cookie has been set and then use it. If it has not been set then to use the 'defaultstyle' sheet which is defaultstyle.css
This however never works and my defaultstyle sheet is always used!
I got the tutorial from A List Apart but the comments section and any way of contacting the author have been removed.
Arrrghh!
Any help out there?
Thanks