Site Help Needed :)


Q-Wi-Q

[Quincy Archer hates you]
Joined
Jan 15, 2004
Messages
495
Age
38
Howdy ppl,

first off: I thought of posting this in the "I need help" section, but it's not really gp32-related (not until someone invents a broadband adapter for it, really), but I've been asked to be webby of the pedagogic sciences-website (it's my studies). My main idea was to have a design that pleases 99% of your people. And since I have 1000 students visiting the site regularly, I decided that I'd make skins.

What I want:

1. you visit the site
2. You click skins
3. You select a skins -> this should load a .css up in the site, so every html-file should get load up that css
4. The information is stored in your cookies (or something similar) so when you come back, it's still the same skin.

I don't know how to do it though. So I figured: lots of smart ppl here, maybe some one should know how to pull it off? :)
 
Javascript can probably do it but a far easier option is trendy PHP. Then you just need this code in the header:

Code:
// array of themes
$themes = array( 'default', 'blue', 'green', 'blind', 'cheese' );

$theme = $_GET['theme'];
if ( $theme )
{
  // a theme was given to us via the themeselector form (below)
  setcookie( 'theme', $theme, 365*60*60*24 ); // syntax is probably wrong, need to check manual - setting theme in user's cookie for a year
}
else
{
  // no theme, attempt to load from cookie
  if ( isset( $_COOKIE['theme'] ) )
  {
    $theme = $_COOKIE['theme'];
    setcookie( 'theme', $theme, 365*60*60*24 );
  }
  else
  {
     // that sucks, define the default one
     $theme = 'default';
  }
}


// actually cause the page to load the theme's css
echo YOUR PAGE HEADER GOES HERE
echo '<link rel="stylesheet" href="theme_' . $theme . '.css" />';

echo SOME OTHER CRAP

// Now for the combo box of themes, baby!
echo '<form method="GET" name="themeselect">Select a theme: <select name="theme" onChange="document.themeselect.submit()">';
foreach( $themes as $theme ) echo "<option>$theme</option>';
echo '</select></form>' 
}

And that's pretty much it. You just need a bunch of css files now like theme_default.css, theme_cheese.css. Oh, as for actually implementing this, depends if you have PHP or not :p

PS: I called them themes partly 'cos skins are usually fully graphical, but mostly out of accidental habit. Oh well.
 
themes then :)

anyhow: thanks for the help, I should check if the server has php support though... :)

but thanks!
 
Back
Top