The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

[Solved] Recommend a Plugin for Image Rotator?

  • # November 20, 2009 at 10:12 pm

    Hi all,

    I’m curious which plug-in you all would use to load a new image each time a page is visited. A sample of what I’m looking for is here

    A new image loads at the very top of the page each time the page is reloaded. I’m looking for the most simple method of accomplishing this. If the images were selected randomly from a folder that would be sweet!

    Any input appreciated.



    # November 20, 2009 at 11:57 pm

    I just do it manually…

    I name all the images with the same name and a different number 1-10, then say:

    /images/imgname<?= rand(1,10) ?>.jpg

    I’m pretty sure that’s right…

    # November 21, 2009 at 3:16 pm

    That’s a good option. I could change images without changing code. That is my real goal. To allow a client to update the images used in the rotator without having to adjust any code.

    Anyone have any other options that they use for this scenario?

    # November 22, 2009 at 5:26 pm

    I’m not able to get <?= rand(1,3) ?> to work.

    I’ve tried searching for the correct syntax but I’m not finding an answer. Any suggestions?

    Here is the code I’m using:

    # November 23, 2009 at 2:58 am


    My first guess is that your server doesn’t allow short hand. Try this:

    # November 23, 2009 at 4:26 am

    This reply has been reported for inappropriate content.

    My thought was exactly the same as Mr Sanders :)

    <? is shorthand for <?php – but a lot of servers do not support it by default.

    # November 23, 2009 at 9:54 am


    I had tried <?php… but forgot to add "echo". I’m still getting the hang of php. The code works perfectly now.

    Thanks again,


    # November 23, 2009 at 1:32 pm

    Excellent [img][/img]

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

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed