View Full Version : CSS switching
Ether whistle
11-12-2009, 12:15 AM
I just started learning CSS and i want to know one thing:
Lets say that i have like 3 totaly diferent .css (for simple example one has a red background, other has black, and the 3rd has a yellow background collor).
And lets say that a visitor can pick one of three themes (.css), and during his session every page will load with that .css. The same thing is with languages.
How do i do that.
I would be grateful for beginner-frendly explanation, but any explaantion will do as long as there is one.
Thank you for your time.
auriaks
11-12-2009, 12:27 AM
add theme variable to your sql table where you register all links and set first value to theme1.css. Then he can change this value by pushing button with UPDATE querry in you webpage.
Also you will need session to get his theme variable and include it to your
<link rel="stylesheet" type="text/css" href="../<?php include $theme?>" />
HTH :)
Ether whistle
11-12-2009, 12:44 AM
Yes that is helpfull, but i'm looking for more database independent and more cookie approach. :)
For example i have a site that doesn't have a database, but a have cookies, and when you visit my site I give you a cookie with the session time and stuff, when you change the theme i send you cookie, so next time you visit my site i read the data on cookie and change the theme according to that, and if a cookie expired or there is none i just load default.css for example. Now the question is how do i do that in html or whatever :)
auriaks
11-12-2009, 12:51 AM
what cookie do you have to store theme?
Ether whistle
11-12-2009, 10:02 AM
what cookie do you have to store theme?
I won't store theme on a cookie, i will store some value like ccsId=0 or ccsId=1 and when the page loads up somehow i want html to read the value and load an appropriate external css.
something like
[pseudo code]
if(ccsId==1)
load
css1.css
else
load
cssDefault.css
[/pseudo code]
I am sorry if I'm not making this clear enough, i lack sufficient knowledge :(
auriaks
11-17-2009, 10:13 PM
ok, but how you will get your pseudo code? (ccsId)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.