SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Rotator script

  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rotator script

    Hi everyone, i'm new here and would like to ask some advice!

    I want to create a jv mini giveaway page, so say 4 rows with 3 columns to display the gift image, brief description and a link to the download page. But I want the gifts to rotate so each have a fair share of views on the top row. Is there a script that could help me with that? Each person will have their own unique trackable link to their own webpage.

    Thanks

    Craig

  2. #2
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Each person will have their own unique trackable link to their own webpage
    Not sure of what the relevance of this is???

    Maybe not exactly what you're asking for, but this code would give you random values on page load for each table row:

    PHP Code:
    $text = array('Gift one','Gift two','Gift three','Gift four','Gift five');
    shuffle($text);
    echo 
    '
    <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        </head>
        <body>


    <table>
    <tbody>
    <tr>
    <td>1</td><td>'
    .array_pop($text).'</td>
    </tr>
    <tr>
    <td>2</td><td>'
    .array_pop($text).'</td>
    </tr>
    <tr>
    <td>3</td><td>'
    .array_pop($text).'</td>
    </tr>
    <tr>
    <td>4</td><td>'
    .array_pop($text).'</td>
    </tr>
    <tr>
    <td>5</td><td>'
    .array_pop($text).'</td>
    </tr>
    </tbody>
    </table>

        </body>
    </html>    

    '

    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    shuffle is probably the best way to do it without database interaction;

    If you want to ensure that they've all been displayed equally, you'll need to track how many times they've been top-row.
    Insert a counter field into your table, alter your select query to pull the lowest number of the count first, and add an update to increment the count for the top rows.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •