I am currently trying to roll my own CSS style switcher for my basic intranet.
It's not hugely important, but I know a couple of employees have slightly poor eyesight and thought a high contrast style may be of some use.
Here is my ideal set up, and the way I have tried to implement so far.
Basically I already have a mysql database that house user log on details, and other minor preferences regarding the site. I would like to have an extra column for the style preference, and have a simple page in the user area where the user can preview, select and apply the style.
It would obviously be good if when the user selects the style initially, it applies it to the page so that it can be seen in action, and then can be confirmed if it is what the user chooses.
What I have attempted so far:
Basically, when the user logged on, it created a session variable which contains the value of the "style" column for that user. I went with numbers for the test, with a choice of 3 styles, 1, 2 and 3. Then in the head section of the page, for the href of the stylesheet, I added some PHP that evaluated the session variable and echoed a stylesheet based on what was set.
That worked fine, the stylesheet was different depending on what was in the mysql table for the style column. On the user preferences page is where I fell apart a bit. I created a small form with 3 radio select buttons, one for each style. The only way I could see to go from here, was for the form to post to a PHP file that updates the table based on selection.
The main problem I have doing it in this manner is that the user has to log out and back in for the changes to take effect. I would like a setup where the change happens on the spot or on a refresh.
I could go with cookies, but would rather avoid if possible. Don;t know if anyone has any suggestions to help me along or if there are any pre written scripts that could accomplish this?
Many thanks
Eds
<link rel="alternate stylesheet" title="Large Print" src="bigtext.css" />. On FF< that makes "Large Print" be an option in the View->Page Style menu.