Banner Rotation Add-on / Plugin for vBulletin

Discussion in 'vBulletin Discussions' started by ArnyVee, Dec 31, 2009.

  1. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
    Guys and gals,

    I'm using this option on my vBulletin forum sites: vbBannerRotator - vBulletin.org Forum

    Does anyone know how I can turn this into a mod with unlimited (or at least make it a higher number than 10 rotating banners) spaces for ads?
     
  2. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
  3. MjrNuT

    MjrNuT Grand Master

    Joined:
    Oct 14, 2009
    Messages:
    579
    Likes Received:
    36
  4. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
    I started reading a bit, but didn't see if there was a limit to the number of banners able to be rotated or not.

    I'll keep reading, but anyone know off hand?
     
  5. Nick

    Nick Regular Member

    Joined:
    Jul 27, 2008
    Messages:
    7,441
    Likes Received:
    218
    Couldn't you just manually place some javascript to rotate some banners? This code allows for unlimited banners to be placed into rotation:

    Code:
    <script language="JavaScript">
    <!--
    
    /*
    Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com) 
    Over 200+ free JavaScripts here!
    Updated: 00/04/25
    */
    
    function random_imglink(){
    var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[1]="image1.gif"
    myimages[2]="image2.gif"
    myimages[3]="image3.gif"
    myimages[4]="image4.gif"
    myimages[5]="image5.gif"
    myimages[6]="image6.gif"
    
    //specify corresponding links below
    var imagelinks=new Array()
    imagelinks[1]="http://www.javascriptkit.com"
    imagelinks[2]="http://www.netscape.com"
    imagelinks[3]="http://www.microsoft.com"
    imagelinks[4]="http://www.dynamicdrive.com"
    imagelinks[5]="http://www.freewarejava.com"
    imagelinks[6]="http://www.cnn.com"
    
    var ry=Math.floor(Math.random()*myimages.length)
    if (ry==0)
    ry=1
    document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
    }
    random_imglink()
    //-->
    </script>
    
    <p align="center"><font face="arial" size="-2">This free script provided by</font><br>
    <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
    Kit</a></font></p>
    
    From: Cut & Paste Random Image Link
     
  6. Demo

    Demo Regular Member

    Joined:
    Jun 9, 2009
    Messages:
    172
    Likes Received:
    6
    Location:
    Europe
    First Name:
    Demo
    Cleanest random rotation thingy made by me, works like a charm. Requires one vBulletin plugin to be made and one new PHP file to be made.

    Plugin:
    Hook: global_start
    Execution order: 6
    Code:
    PHP:
    ob_start();
    include(
    '/PATH/TO/ROTATIONBANNER.PHP');
    $rotationbanner ob_get_contents();
    ob_end_clean();
    ROTATIONBANNER.PHP:
    PHP:
    <?
    $num Rand (1,3);
    //Edit the 3 above for the number of cases below
    switch ($num)
    {
    case 
    1:
    echo 
    "First banner";
    break;
    case 
    2:
    echo 
    "Second banner";
    break;
    case 
    3:
    echo 
    "Third banner";
    }
    ?>
    After that, add $rotationbanner to your template.
     
  7. MjrNuT

    MjrNuT Grand Master

    Joined:
    Oct 14, 2009
    Messages:
    579
    Likes Received:
    36
    Yeah the reason I picked this one was that it had no limit on the number of banners. Also, you implement the banner via another menu within vB from forumhome, Quick Links tab. Meaning it has its own interface.

    It only has 1 issue imo, but may not matter to you, the only access to that gui is if an account is set as Super User, which is ONLY done in config.php. This comes into play if you desire others to implement banners.

    Hope that helps. I also like those other methods Nick and Demo provided.
     
  8. Demo

    Demo Regular Member

    Joined:
    Jun 9, 2009
    Messages:
    172
    Likes Received:
    6
    Location:
    Europe
    First Name:
    Demo
    Made an even WAY better one; one plugin, no external file. Didn't expect it to be so easy :doh:

    Hook: global_start
    Code:
    PHP:
    $banner[1] = "Cats";
    $banner[2] = "Dogs";
    $banner[3] = "Godzilla";

    $rotator rand(13);

    $bannerrotator $banner[$rotator];
    Then placing $bannerrotator in a template.
     
    2 people like this.
  9. ArnyVee

    ArnyVee Regular Member

    Joined:
    May 25, 2009
    Messages:
    1,264
    Likes Received:
    39
    Demo, that seems like it's very easy!

    Nothing in "code" for the plugin? And, I just put the URL of the banner between the quotations? Would I also put the code for an affiliate code there? Then, I assume that I'd simply change the number from 3 to the number of banners that I'm looking to have rotate, right?
     
  10. Demo

    Demo Regular Member

    Joined:
    Jun 9, 2009
    Messages:
    172
    Likes Received:
    6
    Location:
    Europe
    First Name:
    Demo
    If you want to maintain full control of the images (height, width, alt, links, etc. per banner), you'd best put the full image codes into the plugin. It requires some slashes because of the quotation though. Something like:

    PHP:
    $banner[1] = "<a href\"http://www.affliate1.com\" target\"_blank\"><img src=\"http://www.mywebsite.org/aflliates/affliate1.jpg\" alt\"Click for more information\" style\"border:0; height: 60px; width:480px\" /></a>";
    Yes, the 3 is associated with that

    PHP:
    $banner[1] = "Cats";
    $banner[2] = "Dogs";
    $banner[3] = "Godzilla";
    $banner[4] = "Ants";
    $banner[5] = "Bears";
    $banner[6] = "Whales";
    $banner[7] = "Mice";
    $banner[8] = "Birds";
    $banner[9] = "Fish";
    $banner[10] = "Beetles";
    $banner[11] = "Dinosaurs";
    $banner[12] = "Aliens";

    $rotator rand(112);

    $bannerrotator $banner[$rotator]; 



    Oh, you need to fill in all fields in order not to get any empty results back into your template
     
    2 people like this.

Share This Page