How hard is it to rotate header images?

Discussion in 'HTML & Website Design' started by exponent, Jan 29, 2007.

  1. #1
    Hello. I'm working on building a website and I've found several nice header backgrounds for my website "Explore the US". I would like to set up the page so that every time it loads, it randomly selects one of the backgrounds.

    How much code would be needed? I cant imagine that it would take more than a few lines.
     
    exponent, Jan 29, 2007 IP
  2. exponent

    exponent Peon

    Messages:
    1,243
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
  3. rei1974

    rei1974 Peon

    Messages:
    393
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah just a few lines of javascript would do the trick :)
     
    rei1974, Jan 30, 2007 IP
  4. SirPsychoSexy

    SirPsychoSexy Well-Known Member

    Messages:
    388
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #4
    SirPsychoSexy, Jan 30, 2007 IP
  5. flavoflav

    flavoflav Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    its an easy hack in Vbulletin
     
    flavoflav, Jan 30, 2007 IP
  6. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #6
    <?php
    $bgr = rand(1,4);
    ?>
    <img src="http://www.mysite.com/background/<?php print $bgr; ?>.jpg">
    PHP:
    Nice and simple to get you started. ;)
     
    SoftCloud, Jan 30, 2007 IP
  7. Bween

    Bween Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It can also be done easily in PHP, This will rotate your banner and not randomly display one. To add more than 3 images just add more $Images[] = 'Banner4.xxx'; etc.

    Spoono.com
     
    Bween, Jan 30, 2007 IP
  8. pangea

    pangea Guest

    Messages:
    557
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I agree - javascript is easiest, though you may also want to consider a banner rotator (ie a php script) if you wanted the headers to link to different pages on click
     
    pangea, Jan 31, 2007 IP
  9. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #9
    Javascript may be the easiest, but if you're like me, I usually 98% of the time have it disabled in my Firefox options. :)
     
    SoftCloud, Jan 31, 2007 IP
  10. Lukas

    Lukas Well-Known Member

    Messages:
    1,299
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    130
    #10
    .js disabled ? I hear this more and more.

    is there a php script to write some lines of html..?

    basically, I have a external js write about 10 lines of html, header, image and css menu link for SEO..

    how can that be done with php..?
     
    Lukas, Feb 1, 2007 IP
  11. SoftCloud

    SoftCloud Well-Known Member

    Messages:
    1,060
    Likes Received:
    28
    Best Answers:
    2
    Trophy Points:
    120
    #11
    Lukas - I'd say use the example I did above. :)
     
    SoftCloud, Feb 1, 2007 IP