Using multiple CSS files on one page; how do I do this?

Discussion in 'Programming' started by GSto, Nov 10, 2007.

  1. #1
    I want to make a page that will have several different templates I want to show off. I want to write something where I can have a menu to select different CSS sheets, and then reload the page using said sheet. How would I do this?
     
    GSto, Nov 10, 2007 IP
  2. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try setting a cookie and give it the name of the current active style sheet.

    Lets say you had 3 style sheets: style1.css, style2.css, style3.css

    The simplest way would be too do something like this

    <link rel="stylesheet" type="text/css" href="style<?php echo $_COOKIE['style']; ?>.css" />

    Of course youd have to check the cookie was actually set, and a valid style but hopefully you get the idea :)
     
    tonybogs, Nov 11, 2007 IP