Rotating Ad Module in VB 5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hs4x4
    New Member
    • Jun 2014
    • 29
    • 5.0.X

    Rotating Ad Module in VB 5

    How do i get the ads Module to rotate through the ads instead of showing all of them?

    HS4x4
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 4021
    • 5.7.X

    #2
    Isn't that done through the ad provider settings and not vBulletin?

    Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

    Comment

    • Zachery
      Former vBulletin Support
      • Jul 2002
      • 59097

      #3
      That's not how the ad module works. The ad module shows whichever ads you have selected to show. If you want rotating ads you should look into a third party software to properly handle ad management.

      Comment

      • Ageurtse
        Senior Member
        • Apr 2009
        • 117
        • 3.0.3

        #4
        see how i did it.

        and in the advertisment code i have this .

        Code:
        <center><iframe src='/advertisement/index.html'  Margin-left='auto' margin-right='auto' scrolling='no'  width='500' height='60'></iframe></center>
        for a live demo check www.reefersquest.com

        Attached Files

        Comment

        • glennrocksvb
          Former vBulletin Developer
          • Mar 2011
          • 4021
          • 5.7.X

          #5
          Originally posted by Ageurtse
          see how i did it. and in the advertisment code i have this .
          Code:
          <center><iframe src='/advertisement/index.html'  Margin-left='auto' margin-right='auto' scrolling='no'  width='500' height='60'></iframe></center>
          for a live demo check www.reefersquest.com [ATTACH]temp_63835_1402430744087_32[/ATTACH]
          But it's normally against their TOS to put ads in an iframe.

          Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

          Comment

          • Ageurtse
            Senior Member
            • Apr 2009
            • 117
            • 3.0.3

            #6
            What do you mean with tos?

            Comment

            • glennrocksvb
              Former vBulletin Developer
              • Mar 2011
              • 4021
              • 5.7.X

              #7
              Originally posted by Ageurtse
              What do you mean with tos?
              Terms of Service. Check their terms of service to see if putting ads on iframe is allowed or not.

              Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

              Comment

              • hs4x4
                New Member
                • Jun 2014
                • 29
                • 5.0.X

                #8
                Here is what I ended up doing. Paste the text below into the Ad html field. Change the pic links to your pics. There isn't much intelligence as its just random out of the three options but it works. I just wanted to rotate through a set list randomly.

                <SCRIPT LANGUAGE="JavaScript">
                var MaxAds = 2
                var AdNumber
                var ThisAd = new Array()

                ThisAd[0] = '<img src="http://www.highsierra4x4.com/media/wysiwyg/Banner_Ad3.jpg" border="0">'
                ThisAd[1] = '<img src="http://www.highsierra4x4.com/media/wysiwyg/Banner_Ad2.jpg" border="0">'
                ThisAd[2] = '<img src="http://highsierra4x4.com/media/wysiwyg/Banner_Ad1.jpg" border="0">'
                </script>

                <BODY>
                <center>
                <SCRIPT LANGUAGE="JavaScript">
                AdNumber = Math.round(Math.random() * MaxAds)
                document.write(ThisAd[AdNumber])
                </script>
                </center>
                </BODY>

                Comment

                • glennrocksvb
                  Former vBulletin Developer
                  • Mar 2011
                  • 4021
                  • 5.7.X

                  #9
                  That code needs improvement but at least the <body> </body> tags should be removed.

                  Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

                  Comment

                  • hs4x4
                    New Member
                    • Jun 2014
                    • 29
                    • 5.0.X

                    #10
                    The code may not be sexy but it works for a random banner presentation.

                    Comment

                    • Ageurtse
                      Senior Member
                      • Apr 2009
                      • 117
                      • 3.0.3

                      #11
                      And how can i put a link with this picture.
                      Can this just be done by placing < a href="..."> </a> around the image tag's ?

                      and how to autoload after x seconds the next banner.
                      Last edited by Ageurtse; Sun 13 Jul '14, 9:27pm.

                      Comment

                      • voclain
                        Senior Member
                        • Aug 2002
                        • 411
                        • 3.0.3

                        #12
                        I want in on this discussion......

                        Here is what I have pasted into my BANNER AD section at the very top of my forum in the HEADER section:

                        <SCRIPT LANGUAGE="JavaScript">
                        var MaxAds = 2
                        var AdNumber
                        var ThisAd = new Array()

                        ThisAd[0] = '<a href="http://www.kvphoto.com" target="_blank"><img src="http://www.fiip.net/images/kvban1_lg.jpg" alt="Kirk Voclain Photography MODELS WANTED" border="0"></a>'
                        ThisAd[1] = '<a href="http://www.kvphoto.com" target="_blank"><img src="http://www.fiip.net/images/kvban2_lg.jpg" alt="Kirk Voclain Photography High School Senors WANTED" border="0"></a>'
                        </script>


                        <center>
                        <SCRIPT LANGUAGE="JavaScript">
                        AdNumber = Math.round(Math.random() * MaxAds)
                        document.write(ThisAd[AdNumber])
                        </script>
                        </center>
                        I currently have 2 banners just for testing.....and I hope to have HUNDREDS soon....but I'll settle for 10

                        First question:

                        Do I just keep adding:

                        ThisAd[3]
                        ThisAd[4]
                        ThisAd[5]

                        And so on and so on????

                        Next QUESTION/Problem.......with the 2 I have as you see it above....sometimes when I refresh the page I get "UNDEFINED" in the banner space...and nothing shows up....what do I need to ADD or SUBTRACT from the script to make it NOT do that???

                        Thank you for all your help!!!!

                        Yours,

                        Kirk

                        Comment

                        • hs4x4
                          New Member
                          • Jun 2014
                          • 29
                          • 5.0.X

                          #13
                          Yes you can just keep adding ThisAd[]s. Remember to change the number of the MaxAds to reflect how many you have. Not sure on the "Undefined"

                          I am working on another script that actually pulls the info from a table, instead of you spelling it all out in the script. Ideally, you would populate the table with the Link, Image info and the MaxAds would be equal to how many entries are in the table. This way you could put this banner script on multiple pages, templates and only have to update the table for them all to work correctly.

                          ***** UPDATE *****

                          The reason you are getting the undefined is because you only have two entrys and you left the MaxAds=2. With two entries it should be MaxAds=1.
                          Last edited by hs4x4; Sat 16 Aug '14, 9:08am. Reason: Added a second comment.

                          Comment

                          Related Topics

                          Collapse

                          Working...