View Full Version : Skin Switcher?
oktam
08-02-2005, 02:12 PM
Hey,
I aint too sure if this has been done, or is a feature of SD, but here goes.
Is there a skin switcher, for members to change which skin they want to use?
I am going to setup an SD test stie where I can show off my work, and I need this plugin/mod to do so.
jennec
08-02-2005, 02:20 PM
I would imagine that if you coudl do this by creating one skin installation with all the designs in it that you want show off, and then one category assigned to each design.
Have not tried it though so can't gaurntee it would work.
oktam
08-02-2005, 02:23 PM
Originally posted by jennec@Aug 2 2005, 09:20 AM
I would imagine that if you coudl do this by creating one skin installation with all the designs in it that you want show off, and then one category assigned to each design.
Have not tried it though so can't gaurntee it would work.
203
BRILLIANT!!!
You should be a geinus or something!
abcohen
08-02-2005, 03:06 PM
Well you could always make a skin that requires everything from CSS... then make a plugin that will change the CSS based on a drop down menu... (it'll take a lot of work... but it'll get you what you want)
FASherman
08-02-2005, 04:17 PM
I took a look at this once and it really isn't feasable - switching actual skins.
What you CAN do is make a single generic skin, and populate ALL of its customizing features - from the logo on down via CSS. Make sure your stylesheet is EXTERNAL and include it via the LINK element:
echo '<link href="style1.css" rel="stylesheet" type="text/css">';
Follow me so far?
Now here's where it gets a bit more involved.
You want to have a forum in this generic skin where you can select the style - like in most forums.
Just like in forums, once the user selects a new style, you want to set a cookie - only if they use cookies - to save the new style selection.
It also should RELOAD the page after setting the cookie.
Remember the line above, setting the stylesheet? Now you'll need to change that. It has to check for the style sheet ID in the cookie, and if present, load THAT stylesheet, otherwise load a default style.
That is the best way to do this. In fact, if someone (other than me, I'm busy on other projects) were to do this, two things would happen...
1. They'd win the skinning contest hands down. IMHO, it would be an even better skin than VB35-SuperSkins - which does basically the same thing, but just for VB3
2. Other people who don't understand how to build skins could still build their own (if the CSS elements were properly documented), just by copying and modifying a CSS stylesheet.
It would be POWERFUL. Very, very powerful.
abcohen
08-02-2005, 04:22 PM
And to give someone the 101 on how to do all this...
http://www.sitepoint.com/article/css-simple-style-switcher
and I'll even provide someone with more help...
<?php
session_start();
$all_css = array();
$all_css['yellow']['file'] = "home_geel.css";
$all_css['blue']['file'] = "home_blauw.css";
$all_css['modern']['file'] = "home_modern.css"; // default
$all_css['yellow']['label'] = "Yellow!";
$all_css['blue']['label'] = "Deep blue";
$all_css['modern']['label'] = "Final..."; // default
$default_value = "modern"; // set the default value here
if (isset($_GET['change_css']) && $_GET['change_css'] != "") {
* *$_SESSION['css'] = $_GET['change_css'];
} else {
* *$_SESSION['css'] = (!isset($_SESSION['css'])) ? $default_value : $_SESSION['css'];
}
switch ($_SESSION['css']) {
* *case "yellow":
* *$css_file = "home_geel.css";
* *break;
* *case "blue":
* *$css_file = "home_blauw.css";
* *break;
* *default:
* *$css_file = "home_modern.css";
}
function style_switcher() {
* *global $all_css;
* *$style_links = "Style switch: \n";
* *foreach ($all_css as $key => $val) {
* * * *if ($_SESSION['css'] != $key) {
* * * * * *$style_links .= "<a href=\"".$_SERVER['PHP_SELF']."?change_css=".$key. "\">";
* * * * * *$style_links .= "<b>".$val['label']."</b></a> *\n";
* * * *} else {
* * * * * *$style_links .= "<b>".$val['label']."</b> *\n";
* * * *}
* *}
* *return $style_links;
}
?>
<!-- EXAMPLE: place this inside your html header -->
<link href="/includes/<?php echo $css_file; ?>" rel="stylesheet" type="text/css">
<!-- place this code inside the body where you want to show the links -->
<?php echo style_switcher(); ?>
Terminator1138
08-02-2005, 04:31 PM
The problem would be having to skin the forum each and every time right? This would have to be done manually.
FASherman
08-02-2005, 04:34 PM
Originally posted by Terminator1138@Aug 2 2005, 11:31 AM
The problem would be having to skin the forum each and every time right?* This would have to be done manually.
213
No, you use the same technique for that as well. The forum wrapper checks the same cookie and all of its attributes are stylesheet defined as well.
larpo
09-05-2005, 09:49 AM
I am working on this at the moment... need a lo-fi version for members connecting via sat phone. If anyone wants any info on this, or has any good advice let me know. I am using the style switching technique from alistapart.
larpo
09-05-2005, 09:50 AM
I am working on this at the moment... need a lo-fi version for members connecting via sat phone. If anyone wants any info on this, or has any good advice let me know. I am using the style switching technique from alistapart.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.