1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to create an add rotator

Discussion in 'HTML & Website Design' started by kf9211, Nov 3, 2007.

  1. #1
    I want to create an ad rotator, that changes the ads that are displayed every time the page is viewed. How would I do this? Is it possible to do this in html?

    Thanks,
    Kyle
     
    kf9211, Nov 3, 2007 IP
  2. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Not in HTML. It would need to be some kind of server side code.
     
    twistedspikes, Nov 3, 2007 IP
  3. itzCarlin

    itzCarlin Active Member

    Messages:
    849
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #3
    i've been looking around for it too

    as the previous poster said, it would not be efficient to do in HTML

    i have figured out that the best way to do it is in javascript, now im just working out a way on how to do it
     
    itzCarlin, Nov 3, 2007 IP
  4. gabibeowulfx

    gabibeowulfx Active Member

    Messages:
    211
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    63
    #4
    well .. you should have an array with ad codes .. you can display the ad with document.write(ar[x]) where ar[0]=code1;ar[1]=code2;x=math.rand(0,1);
    this is how it would work in javascript ;)
     
    gabibeowulfx, Nov 3, 2007 IP
  5. Monty

    Monty Peon

    Messages:
    1,363
    Likes Received:
    132
    Best Answers:
    0
    Trophy Points:
    0
    #5
    In php you need a code like this one :

    <?php
    // array with ads
    $ads = array('ad_code1',
    'ad_code2',
    ' ...' ,
    'ad_code10');
    
    // random display
    $rand = mt_rand(0, count($ads)-1);
    echo $ads[$rand];
    
    ?>
    PHP:
     
    Monty, Nov 3, 2007 IP
  6. kf9211

    kf9211 Peon

    Messages:
    276
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok, but is there a website, or software, where you just enter the adsense and banner ads that you want to rotate and it will give you a code that you can put on your site?

    Thanks,
    Kyle
     
    kf9211, Nov 3, 2007 IP
  7. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #7
    or in .net....

    
    <asp:AdRotator ID="Ad1" runat="server" AdvertisementFile="adsfile.xml" />
    
    Code (.Net):
     
    AstarothSolutions, Nov 5, 2007 IP
  8. EdgEvent

    EdgEvent Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you find one, please let me know. I've been looking to do the same thing and having problems finding a means to do it since i'm not real familiar with php or javascript.
     
    EdgEvent, Nov 5, 2007 IP
  9. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #9
    you can use php ads at http://www.phpadsnew.com , its an opensource program that does exactly what you are looking for and has very good documentation. Setting it up is piece of cake :)
     
    ketan9, Nov 5, 2007 IP
  10. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #10
    Ill build you a custom one in php with click and impression tracking for £25 gbp
     
    liam1412, Nov 5, 2007 IP