anyone would be able to help me out to create Drop down skin selector in php+css? i mean on change css all the content will change into w/e the color they chose?. i currently have the Drop Down...already but just need the php code with "cookies" settings on n stuff..
Skin Selector Dropdown In CSS!
You don't need PHP, you just need some Java:
CSS Creator: User Preference Script
It does what you want.
~Brett
Originally posted by MasumX
anyone would be able to help me out to create Drop down skin selector in php+css? i mean on change css all the content will change into w/e the color they chose?. i currently have the Drop Down...already but just need the php code with "cookies" settings on n stuff..
ya i see that but i dnt want all that i just want one on change blue.css to navyblue.css it will automaticy switch the..content from within the "CSS" file..... but im lost the way they made it :S?
Did you read what was there? They actually explain it.
Of course, you could always just use $SESSION[] or $COOKIE[] or $_GET[] to set it. Send it through the URL.
Then just use a simple switch() or if() statement.
~Brett
I like just providing alternate stylesheets:
<link rel="stylesheet" href="skin1.css" type="text/css" title="Skin1" />
<link rel="alternate stylesheet" type="text/css" href="skin2.css" title="Skin2" />
<link rel="alternate stylesheet" type="text/css" href="skin3.css" title="Skin3" />
Though I don't recall if that works in IE.
No, IE doesn't support multiple Stylesheets.
Look, here's what I would do:
<?php
if(empty($_GET['style']) || !isset($_GET['style']))
{
$style_url = 'http://www.domain.com/styles/style.css';
}
else
{
$style_url = 'http://www.domain.com/styles/'.$_GET['style'].'.css';
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo $style_url; ?>">
</head>
<body>
<!-- Do whatever here -->
<form action="change_style.php" method="post">
<select name="style" onchange="this.form.submit()">
<option value="style1">Style1</option>
<option value="style2">Style2</option>
</select>
<input type="hidden" name="url" value="<?php echo $_SERVER['PHP_SELF']; ?>">
</form>
</body>
</html>
<?php
// change_style.php
$url = $_GET['url'].'?style='.$_GET['style'];
header("Location: ".$url);
?>
~Brett
hmm..not working as i assume it would.....make it lik
on select color Blue go to blue.css and from when it calls blue.css everything will change and...make sure that on refresh it doesnt call back the previous color or the default color?
Here's what I got working:
index.php
<?php
if( empty($_GET['style']) || !isset($_GET['style']) )
{
$_GET['style'] = 'default';
}
$style = './styles/'.$_GET['style'].'.css';
?>
<html>
<head>
<title>A Certain Style :: <?php echo $_GET['style']; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $style; ?>">
</head>
<body>
<div id="wrapper">
<p>This should change depending upon the style!!<br><br>
<form action="changestyle.php" method="post">
<select name="style" onchange="this.form.submit()">
<option value="null" selected>Please Choose a Style</option>
<option value="blue">Blue</option>
<option value="pink">Pink</option>
<option value="green">Green</option>
<option value="default">Default</option>
</select>
</form></p>
</div>
</body>
</html>
changestyle.php
<?php
$style = $_POST['style'];
if($style == 'null')
{
$url_suffix = 'default';
}
else
{
$url_suffix = $style;
}
$url = 'index.php?style=';
header("Location: ".$url.$url_suffix);
?>
default.css
body
{
background: #f7f7f7;
text-align: center;
}
#wrapper
{
width: 500px;
margin: 0 auto;
padding: 0;
border: 2px solid #000;
background: #ccc;
text-align: center;
}
#wrapper p
{
width: 500px;
float: left;
text-align: left;
margin: 5px 10px;
}
#wrapper p form
{
width: 150px;
float: left;
margin: 0 auto;
padding: 0;
}
I changed the background colors in the CSS files to what I wanted. This does work, I know for a fact.
~Brett
ok that does it but need cookies? can u set a cookies sys? thanks! and btw how do i "call" .css like currently i have
default.css
pink.css
green.css
purple.css
navyblue.css
slateblue.css
burlywood.css
so how do i point them in there?
????????
Hi, I have a life, and couldn't get to it within the 30 hours and 7 minutes of your posts. I'll get to it, cuz I can do it, but I need time. My weekend is busy, but I'll do it, and give you an example. Of course, you could always look at what csscreator.com has, since they use cookies. Try and merge the two, but I will post something here again, just be patient.
~Brett
oh ok..thanks and im sorry...
I'm not quite sure if this is what you want, but I did something quite similar in JavaScript:
http://www.albanybusiness.info
The color chooser on the side COULD be used for stylesheets.
Plus it wouldn't put more load on your server...
Well, if you think it's suitable, I can send you the code.