CSS Style Switcher
I have 3 styles which could be applied to a web page, I want users to be able to change the style depending on which style they prefer and save the setting to a file (E.g. Not cookie based).
User Selects Theme -> Selection written to file --> User visits the site again and the theme selected is displayed again
Any help appreciated - Preferrably PHP based also possible to save setting in a database table or flat file.
I'm no expert, but I can't see how this is possible without a cookie. There has to be some way of the user being recognised in order to select their preferred style, so that (as far as I know) means a cookie or them entering a username (which would of course defeat the object of the exercise!).
You could use their IP address, but they change...
Anyone know better? :)
Its basically a website where an Administrator will set the Theme for the whole school, this admin will not have access to the web server where the site and styles are kept so i need some dynamic way of the admin being able to do this.
This is the reason why a cookie would not do it, it doesnt need to be user specific it needs to be site specific.
in the header of the file (named something.php) where the css would go (between <style> and </style>):
(done in php)
if you need to allow them to switch based on a web form, you need to create a form with a dropdown with the themes in, then process the data received to write the contents of the file referenced above.
$config_theme = '/home/user/www/mysite/config_folder/config.cfg';
//check config file exists
//open file, read the contents to variable
$theme = file_get_contents ($config_theme);
If you don't need them to do that via web and they can access the file direct, you can set the variable in the config file and just include it before pulling the css file.
EDIT: let me know if you need help with the form parts.