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.

Banner Image rotation links

Discussion in 'HTML & Website Design' started by powerlifer, Dec 28, 2008.

  1. #1
    Hey i have a vbulletin forum and what i want is to have say 8 banners that all link to different advertisers.

    Is there any simple way to do this?

    Anyhelp is appreciated.
     
    powerlifer, Dec 28, 2008 IP
  2. ExtremeData

    ExtremeData Well-Known Member

    Messages:
    450
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    125
    #2
    You can do that with javascript :

    <script type="text/javascript"> 
    var randomnumber=Math.floor(Math.random()*101)
    if(randomnumber>50){ 
    var banner1 = "Here Banner 1";
    document.write(banner1);
    } else { 
    var banner2 = "Here Banner 2";
    document.write(banner2);
    }
    </script>
    Code (markup):
    Add this code to a page and refresh it to see how it works.

    Where is "Here Banner 1" and "Here Banner 2" you will have to ad the banner code.
    For 8 different banners you will need to add multiple banner vars like
    var banner3 ="Here Banner 3"
    Code (markup):
     
    ExtremeData, Dec 28, 2008 IP
    greenghost likes this.
  3. greenghost

    greenghost Well-Known Member

    Messages:
    816
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Does it work with SMF too??
     
    greenghost, Dec 28, 2008 IP
  4. ExtremeData

    ExtremeData Well-Known Member

    Messages:
    450
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    125
    #4
    It's just a javascript code...
    This code works in any web page.
     
    ExtremeData, Dec 28, 2008 IP
  5. powerlifer

    powerlifer Active Member

    Messages:
    2,002
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    78
    #5
    So will that work on refresh i.e i want it like the ads at the top right of this forum.

    But on refresh say google ads, then an affiliate, then ebay etc, amazon and so on.

    Thanks for the help man
     
    powerlifer, Dec 28, 2008 IP
  6. greenghost

    greenghost Well-Known Member

    Messages:
    816
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    130
    #6
    ooh great...it helps me :)
    thank you
     
    greenghost, Dec 28, 2008 IP
  7. ExtremeData

    ExtremeData Well-Known Member

    Messages:
    450
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    125
    #7
    On my example the script generate a random number and if the number is greater than 50 then the script will show the 2nd banner(you can use a infinite number of banners).
    BTW be careful if you use a adsense code for example you will need to escape the quotes and to add \n\ for a new line like in this example :

    <script type="text/javascript"> 
    var randomnumber=Math.floor(Math.random()*101)
    if(randomnumber>50){ 
    // START ADSenses ADS
    var googleadss = "\
    <script type=\"text/javascript\"><!--\n\
    google_ad_client = \"pub-3084505037735566\";\n\
    google_ad_slot = \"1731171369\";\n\
    google_ad_width = 468;\n\
    google_ad_height = 60;\n\
    //--><\/script>\n\
    <script type=\"text/javascript\"\n\ 
      src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n\
    <\/script>\n\
    ";
    document.write(googleadss);
    // END Adsenses ADS
     } else { 
    // BEGIN ADSENSE ADS
    var googleads = "\
    <script type=\"text/javascript\"><!--\n\
    google_ad_client = \"pub-3084505037735566\";\n\
    google_ad_slot = \"1581398381\";\n\
    google_ad_width = 728;\n\
    google_ad_height = 90;\n\
    //--><\/script>\n\
    <script type=\"text/javascript\"\n\ 
      src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n\
    <\/script>\n\
    ";
    document.write(googleads);
    }
    // END ADSENSE ADS
    </script>
    Code (markup):
    I use this type of script on many websites and is simple but powerfull.
     
    ExtremeData, Dec 28, 2008 IP
  8. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #8
    on PHP enabled servers
    I use
    imagerotator.php
    meanwhile there appear to be several versions online
    that is a simple php script installed IN the banner folder of your site
    and rotates each time a page loads to show a new banner each time

    I have it since many years on my blog ( see sig link below ) and it works perfectly. it also works for other file extensions.

    it is ONE single file you upload into the one directory storing all your banners
    and there are max 3 lines you need to change
    - add the path into your template of page using the banner
    - change IN the script the server-path to your banner-folder
    - add / change file extensions of files being rotated

    if you interested and can't find a suitable copy / version online - then EMAIL me directly and I send you the version I use - the site once creating it no longer offers that script for download
     
    hans, Dec 28, 2008 IP