
January 5th, 2004
05:37 AM
Skater From Flower Mound YAY
Status: Offline!
Letting Users Choose Colors For A Site
Hey, its me again, ironically with more questions about skinning a site. I've got the basic skinning part down, thats really simple now, and setting cookies shouldn't be to hard with this one, though I probably will need help with it later. Onto my question:
I'm redesigning my site, and of course I want it to be skinnable. This time I leaned towards just colored tables, to make a less graphically intense website and also make it more versitile and viewable in more resolutions and more browsers. Now on a site I used to go to they had the same thing as me, colored tables and a skinnable site. They had pre-made themes to pick from but they also had it where the user could input colors into a form, submit it and their choices would show up. I know you'd use cookies to store the choices, and could echo the colors out into that tag, but I'm baffeled on how I'd retrieve those colors and how I'd set the cookie to save them and how the user would go about picking the colors(how the form would have to act for it to work). If anybody could help me I would greatly appriciate it!
Thanks in advance!
-Alex
___________________
Useless Skaters
RaiseUp.net
Alex-Ramos.net
Last edited by ramos, January 7th, 2004 03:46 AM (Edited 1 times)

January 5th, 2004
07:46 AM
Neversidian
Status: Offline!
just use css and have different stylesheets. red, orange, yellow, green, blue, indigo, violet. ROYGBIV
(it was the only thing i learned in elementary so i figure i had to get it out)
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

January 5th, 2004
04:14 PM
Skater From Flower Mound YAY
Status: Offline!
thats not what I have the problem with. I know how to skin a site, thats simple. I need help having users input colors into a form and having them save those colors.
-alex
___________________
Useless Skaters
RaiseUp.net
Alex-Ramos.net

January 6th, 2004
08:46 AM
Neversidian
Status: Offline!
use a db or tect files. you could also just create a css file for each user i guess too and set that file as a cookie.
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

January 6th, 2004
11:38 AM
Neverside Newbie
Status: Offline!
hey
On Spoono, to save flavors for specific people, we just cookie up a number between 0-7. then when you come to the site, if it's 1, then you load the first one, and so on
___________________
- -- --- ---- ------ ------ -------
Akash Goel
Webmaster
www.spoono.com
www.tutorialforums.com
- -- --- ---- ------ ------ -------

January 6th, 2004
10:02 PM
Skater From Flower Mound YAY
Status: Offline!
well I've only got about 5 or 6 different things they pick colors for, would I be able to save that all in a cookie?
If that would work can anybody make, or tell me what to use to make a script that would pick them and set them to a cookie. I think thats what I was trying to say before. Also, I have all my values being echo'd out if that makes a difference.
Thanks!
-Alex
___________________
Useless Skaters
RaiseUp.net
Alex-Ramos.net
Last edited by ramos, January 7th, 2004 04:00 AM (Edited 1 times)

January 7th, 2004
08:42 PM
Skater From Flower Mound YAY
Status: Offline!
Ok, I've made an image to show you what I mean. For every number I have on there, I want the visitor to be able to pick what color goes there. Under the <font> tags I have PHP echo out the selection, for instance:
<font color="<?php echo"$fontcolor"; ?>"> Blah Blah Blah </font>

I want the choices they input into a form to be saved into a cookie and echoed out on the page so they see my site JUST how they want it. I hope this better explains what I mean.
-Alex
___________________
Useless Skaters
RaiseUp.net
Alex-Ramos.net
Last edited by ramos, January 8th, 2004 12:28 AM (Edited 1 times)

January 7th, 2004
10:23 PM
Ugh... Leave this blank for now
Status: Offline!
This is a sidenote but they removed a color from the rainbow, im pretty sure it was indigo
___________________
...

January 10th, 2004
05:53 AM
Skater From Flower Mound YAY
Status: Offline!
Ok, I've tried a few of my own ways and I've almost gotten it to work. All I needed to do was select the colors with a form, and make them go to a page that will set a cookie with all the info in them. Here's my first problem: I set the cookie and have all the input boxes named ex. - "bgcolor". If I want the cookie to set as the color they picked what should I put under "here":
<?php setcookie('bgcolor', 'here' time() =3600*365); ?>
Onto my second delamia:
<?php
if ($theme==""){
$bgcolor = "333333";
$headcolor = "555555";
$fontcolor = "FF9900";
$link = "FF9900";
$vlink = "FF9900";
$alink = "AAAAAA";
$bordercolor = "FF9900";
}
elseif ($theme=="1"){
$bgcolor = $_COOKIE['bgcolor'];
$headcolor = $_COOKIE['headcolor'];
$fontcolor = $_COOKIE['fontcolor'];
$link = $_COOKIE['link'];
$vlink = $_COOKIE['vlink'];
$alink = $_COOKIE['alink'];
$bordercolor = $_COOKIE['bordercolor'];
}
?>
I know that is EXTREMELY wrong, just using it till I find out how to do this.
How do I make it so that the visitors chosen color shows up when they come but there is also a coexisting default theme without using the '?theme' variable in the address?
If any part of this doesn't make sense to you but you think you can help me please do! I would really appriciate it! I think you guys understand what I was talking about before, I really want to get this done soon, I've been working the last week on it and it doesn't seem too complicated. Thanks!
-Alex
___________________
Useless Skaters
RaiseUp.net
Alex-Ramos.net

January 10th, 2004
09:15 AM
Neversidian
Status: Offline!
first question
use $_POST['bgcolor'] instead of 'here'
second question doesnt make sense for the most part.
imho youre going about it the wrong way. here is a simple way of doing stuff
<?php
if(!isset($_COOKIE['theme'])){ // if the cookie isnt set use the default
$theme['bgcolor'] = '#000000';
$theme['text'] = '#FFFFFF';
//etc
}else{ // if it is set, use the users theme
$theme = userialize($_COOKIE['theme']); // unserialize the cookie value to get all the data
}
?>
and to set the cookie do like this
<?php
setcookie('theme',serialize($_POST),time()+60*60*24*7); // serialize the data to use just one cookie with all data
?>
then just send a post to the page with the id's being like bgcolor and text etc, that way it will remember them all and all can be different.
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!