Re: Choose your style sheet

by "Mike Taylor" <lonewolf(at)one.net>

 Date:  Wed, 16 Oct 2002 23:30:32 -0400
 To:  <hwg-techniques(at)hwg.org>
 References:  alg2
  todo: View Thread, Original
I'm pretty light on the PHP but I think I know of a way you could do it:

Have each value in the drop-down list point to a PHP file with a value in
the querystring for each stylesheet.

example:

<.option value="this.php?style=crazy">Crazy Style<./option>
<.option value="this.php?style=ugly">Ugly Style<./option>
<.option value="this.php?style=sweet">Sweet Style<./option>

Then on your PHP page (the one you want to be affected by the stylesheet)
have something like this:

<?

switch ($style) {
    case "crazy":
  $thestyle = "/styles/crazy.css";
        break;
    case "ugly":
  $thestyle = "/styles/ugly.css";
        break;
    case "sweet":
  $thestyle= "/styles/sweet.css";

        break;
}


?>

And then in your <.head> put something like:

<link rel="stylesheet" href="<? echo $thestyle ?>" type="text/css">

Haven't tried the above but I think it will work.  Also, if you want to skip
the Case statement, you could maybe put the full path in your querystring
and just refer to that value when it gets echoed out.

HTH,
Mike

----- Original Message -----
From: "Anthony Gloster" <alg2(at)alg2.com>
To: <hwg-techniques(at)hwg.org>
Sent: Wednesday, October 16, 2002 9:05 PM
Subject: Choose your style sheet


> Hello All,
>
> I have developed a few sites with multiple style sheets for users that
> happen to be using browsers that will allow them to choose the CSS look
> they like (such as Netscape 6.2). I recently went to
> http://roselli.org/adrian/ and noticed that he given the visitor the
> ability to choose the style sheet right from the page. I would like to use
> this on my sites for my visitors that use IE. Does anyone know of a  HOWTO
> or tutorial on how to do this with PHP or SSI (since all of my sites are
> hosted on Apache)?
>
> Thanks
>
> ALG2
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA