Web Development Thread, CSS Style Switcher in Coding and Web Development; I have 3 styles which could be applied to a web page, I want users to be able to change ...
22nd August 2008, 02:55 PM #1
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.
22nd August 2008, 03:34 PM #2
- Rep Power
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?
22nd August 2008, 05:58 PM #3
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.
22nd August 2008, 07:36 PM #4
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.
Last edited by kesomir; 22nd August 2008 at 07:38 PM.
By alonebfg in forum EduGeek Joomla 1.5 Package
Last Post: 12th May 2008, 11:29 PM
By speckytecky in forum Web Development
Last Post: 22nd April 2008, 09:39 PM
By StewartKnight in forum General Chat
Last Post: 4th March 2008, 11:05 AM
By carolla in forum Web Development
Last Post: 9th August 2007, 09:19 AM
By tarquel in forum Windows
Last Post: 24th June 2005, 10:38 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)