Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Member a-drive's Avatar
    Join Date
    Mar 2003
    Posts
    94
    Member #
    809
    JUST come up with this concept now

    How would I be able to do it so; every time the website refreshes it loads up a new .css file.

    For instance, someone goes to "the site" and they'll see a blue layout because it's loaded up the blue.css file. But then the user refreshes and it loads up the pink layout because it loaded up the pink.css file etc etc.

    For say a maximum of 10 css files or however many css files are in the css/ directory.

    Anyone got any ideas, links to help, or help themselves?

    Regards,
    Chris

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Randomly: easy
    Per user and rotating: much harder (would require sessions, among other things).

    Which one do you want?
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Member a-drive's Avatar
    Join Date
    Mar 2003
    Posts
    94
    Member #
    809
    Randomly

  5. #4
    Senior Member splufdaddy's Avatar
    Join Date
    Feb 2003
    Location
    Boston, MA
    Posts
    4,488
    Member #
    735
    In last month's contest, jravenscroft did something like this, but the user selected the stylesheet s/he wanted by clicking a link. It's similar to what you want, so some of his code may be beneficial to you. Here's the thread containing his entry. It was a pretty cool feature.

  6. #5
    Member a-drive's Avatar
    Join Date
    Mar 2003
    Posts
    94
    Member #
    809
    Ooo, thanks splufdaddy. This might work for my needs actually.

    Hmm, only problem that I've just thought about with it, and with my idea is there's no cookie that's being set to keep the css sheet.

    Filb; don't suppose you're a God with JavaScript too?

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I used to be but not anymore.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  8. #7
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    ugh...Cookies with javascript scare me...
    - Brian

  9. #8
    Member a-drive's Avatar
    Join Date
    Mar 2003
    Posts
    94
    Member #
    809
    Found the answers to my problems. Thanks anyway guys.

  10. #9
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Originally posted by a-drive
    Ooo, thanks splufdaddy. This might work for my needs actually.

    Hmm, only problem that I've just thought about with it, and with my idea is there's no cookie that's being set to keep the css sheet.

    Filb; don't suppose you're a God with JavaScript too?
    there was no cookie in mine either

    i coulda done this for you using javascript if i had noticed this thread, sorry
    JR

  11. #10
    Junior Member
    Join Date
    May 2003
    Location
    New York
    Posts
    8
    Member #
    1414
    Just for the hell of it

    PHP Code:
    <?php

      
    function randomStyle()
      {
          switch ( 
    rand) )
          {
             case 
    1:
                
    $color 'red';
                break;
             case 
    2:
                
    $color 'white';
                break;
             case 
    3:
                
    $color 'blue';
                break;
             case 
    4:
                
    $color 'grey';
                break;
             case 
    5:
                
    $color 'black';
                break;
          }
          print 
    '<link href="styles/' $color '.css" rel="stylesheet" type="text/css">';
       }

    ?>
    <HTML>
    <HEAD>
      <TITLE></TITLE>
    <?php randomStyle(); ?>
    </HEAD>
    <BODY>
    </BODY>
    </HTML>


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com