943,523 Members | Top Members by Rank

Ad:
Mar 7th, 2003
0

CSS Quicky

Expand Post »
Hi,

I know CSS and XHTML like the back of my hand, but am wondering how you can allow a visitor to a site change the CSS file used (like in TechTalk flat / 3d), but without having the registering system?

I would use it either from a pull down menu or a separate list of links.

Thanks In Advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
boohoo is offline Offline
11 posts
since Mar 2003
Mar 7th, 2003
0
Re: CSS Quicky
The only way that I could think of doing this is via a cookie which expires ... or by using sessions which keep track of the style in use (if the site has some sort of backend web dev language).

This site is based off of phpBB forum software, and there is actually a mod/hack available @ phpBB which allows non-registered guests to change the template based on a cookie. However, the hack is very phpBB specific. You might want to take a look at it to see how it's implemented, but I doubt it would be much help.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Mar 8th, 2003
0
Re: CSS Quicky
Like a cscgal said, set up a cookie. I'm assuming that you don't have an application server, just a regular web server like Apache. You can make a cookie in JavaScript then read it and set up whichever style they choose.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
May 7th, 2003
0
Re: CSS Quicky
if you're going to use PHP for this without any backend DB support (ie mysql, or postgrep) you can use something like

// Set it all up

$cookie_name = 'cookiename'; // Name the cookie
$css = 'layouta'; // Cookie Value
$days = 365; // Cookie Life
$cookie_time = time() + ( (3600*24) * $days);

setcookie ($cookie_name, $css, $cookie_time);

// Suck it all out

$cookie_name = 'cookiename';
$css = $HTTP_COOKIE_VARS[$cookie_name];

YOu should obviously do some kind of check at the top of your file to see if it the cookie exists, if not, then install it with a default profile to start ... and then update it accordingly when the user selects the setup he or wants.

Hope that helps!
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Kristoff is offline Offline
4 posts
since May 2003
Nov 20th, 2003
0

Re: CSS Quicky

hi, I know this is a late post, but I just did the same and it works well..
This code, unfortunately, is javacsript, but there is a php code for it.

basically, get your different css styles ready, then
post this in your <head>


[edit] script removed and added as attachment. peterska2. [/edit]

is this what you want?
You can turn the links into a drop down nav easy. Mine are just links.

Hope it helps...
Attached Files
File Type: txt 4.txt (3.1 KB, 38 views)
Last edited by peterska2; Nov 26th, 2003 at 9:06 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
72dpi is offline Offline
10 posts
since Nov 2003
Nov 20th, 2003
0

Re: CSS Quicky

Forgot to add, change the words footinthedoor with the name of your cookie, also, maybe someone can tell you how to set the days cookie, cos I don't think it is set correctrly.......

=)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
72dpi is offline Offline
10 posts
since Nov 2003
Nov 25th, 2003
0

Re: CSS Quicky

Maybe use PHP instead for this instead

You can learn about the setcookie() function in PHP by going here: http://ca.php.net/manual/en/function.setcookie.php

So, when a user first visits your site, have an option somewhere where they can select which style/CSS they want (using a dropdown maybe) and then when they submit that, then it will drop the cookie on their computer. So the next time they visit, the website checks their cookie to see what style they prefer to use

Let me know if you need some more info!
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
Jan 17th, 2004
0

Re: CSS Quicky

or you could use a skin changer, which would require you to code several styles.
Reputation Points: 30
Solved Threads: 2
Light Poster
SMterminator is offline Offline
41 posts
since Jan 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Front Page newbie needs help!!!
Next Thread in HTML and CSS Forum Timeline: mozilla & dynamic width iframe





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC