Skip to main content

Forums

This topic contains 6 replies, has 0 voices, and was last updated by  al_m473 9 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #25701

    al_m473
    Member

    http://clwydmc.co.uk/

    the home page image at the top of the page changes each time you enter the page, how is this done?

    Al

    #61811

    EamonnMac
    Member

    I don’t see a Javascript being called, so perhaps a PHP image rotator? It certainly seems to be a random selection, several refreshes doesn’t seem to be revealing any particular order…

    Matt Mullenweg developed the code for a method to achieve this here: http://ma.tt/scripts/randomimage/ (it’s been improved upon since, but you’ll get all the detail from the site anyhow).

    EDIT – you might try this with the buffs in the Javascript or PHP forums, you’ll certainly get a better answer! ;)

    #61964

    freewebsites
    Member

    It will automatically change because of the links on it.

    #61965

    TheDoc
    Moderator

    I’m a huge fan of PHP for this. So much so that I’m moving this topic to the PHP section!

    You can simply use the rand() function to achieve the results. Here’s a really simple explanation:

    http://php.about.com/od/finishedphp1/qt … banner.htm

    Essentially, it’ll be something like this:

    <?php
    $num = rand(1, 5);
    ?>

    <img class="classname" alt="" src="images/banner-<?php echo $num; ?>.jpg" />

    #62092

    EamonnMac
    Member

    I like that a lot – look waaaaaay simpler than any other method I’ve seen. Nice one.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star