Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Ad random rotate

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28924
    hal8
    Member

    Can anyone help me out please.

    Ive done something like these https://css-tricks.com/random-ad-positions/ examples on my site but i don’t know how to make the images into links ?

    As you can tell i don’t know much about PHP :o

    Thanks

    #75072
    Rob MacKay
    Participant

    Depending on the link of course…

    Code:
    ad “;
    }

    for ( $i=1; $i < $randomFirst; $i++ ) { echo "ad “;
    }
    ?>

    #75073
    hal8
    Member
    "Robskiwarrior" wrote:
    Depending on the link of course…

    Code:
    ad “;
    }

    for ( $i=1; $i < $randomFirst; $i++ ) { echo "ad “;
    }
    ?>

    Hi Rob….thanks for the quick reply….again :D

    Ive gone for the second method so this is my code

    <?php
    $totalImages = 3;

    $all = range(1,$totalImages);
    shuffle($all);

    foreach ($all as $single) {
    echo "<img src=’//link/ad-$single.jpg’ alt=’ad’ /> ";
    }
    ?>

    So do you know how i would apply it to this method ?

    Thanks again

    #75075
    Rob MacKay
    Participant

    well you just need to wrap your echo’ed <img> tag in an anchor tag. Do you know where it is linking? is each link separate? Where are you getting the link from?

    #75076
    hal8
    Member
    "Robskiwarrior" wrote:
    well you just need to wrap your echo’ed <img> tag in an anchor tag. Do you know where it is linking? is each link separate? Where are you getting the link from?

    Yeh each link will be separate. At the moment there is just 3 links/images, two will go to 2 different domains and one wil link to a page on my site.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.