No announcement yet.

rotating banner

  • Filter
  • Time
  • Show
Clear All
new posts

  • rotating banner

    i know the search button is like god (it knows everything) , but it could not come up with an answer on my question, which is;

    How do I ad a randomly rotating banner to my main forumpage instead of the vbulletin logo?

    In the admin panel i can ad a single logo, but i would like to have it rotating (each time one visits a different banner). Even better would be the integration with phpads or something.

    Let me know! Thanks for your time.

  • #2
    A possibility would be to use this in the phpinclude template:
    $randomnumber = rand(1, 10);

    Then place ten different logos in your images directory, each with the name ending in the numbers 1 to 10, for an example logo1.jpg .

    Then change source from the <img> tag which calls the logo to something like this:

    Then each time a page loads, a randomly selected logo out of the 10 logos would be displayed. However, this is not tested.


    • #3
      HTML Code:
        var Banners = new Array("banners/firstBanner.gif","banners/secondBanner.gif" (etc) )
        var hotLinks = new Array("","")
        var linkTexts = new Array("text1","text2")
        var bnrCntr = 0
        function bancycle() {
          bnrCntr = bnrCntr + 1
          if (bnrCntr >= 2) { bnrCntr = 0 }
          document.Banner.src = Banners[bnrCntr]
          document.Link.value = hotLinks[bnrCntr]
      // -->
      Some of this doesn't work right (I never had time to play with it), but it's close. The actual banner display works perfectly however. Each banner shows for 12 seconds. This code would go in the "headinclude" template of a specific style.

      Note that in this case, the "banners" directory would be directly under your base web directory.


      • #4
        would it matter where you place the script in the headinclude template? because i am just going to place it at the very bottom

        also, would you change in:

        var hotLinks = new Array("",""

        the "",""

        directing them to your image locations like

        or would you just put the link to your forum index?
        Last edited by KenshinRyuSe; Thu 30 Dec '04, 10:10am.


        • #5
          Nope. Anywhere within the (head) (/head) tags is fine.


          • #6
            ah, and the answer to my second question??


            • #7
              hotLinks is the array that contains the place the user will be taken to, if they click a specific banner during it's view period. (I may not have the right syntax for that bit, but it's darn close...)


              • #8
                i see, and what would i do if my banner is not just one gif pic, but different segmented gifs that all come together to make one whole banner?


                • #9
                  Well, by definition a banner is a single image. I really don't know how you'd process a multiple.


                  • #10
                    its because i have certain buttons like Register and New Posts, etc. in the header along with the banner -_-


                    • #11
                      Well, that's a different issue. You can "map" certain areas of a static image to be used like buttons. When a user clicks in the designated area, the action is taken.

                      For example, the code below maps "hot" areas of a static image:

                      HTML Code:
                      <div align="center">
                        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" width="700">
                            <td width="110" align="left">
                      <map name="tb2kmapvert">
                      <area href="" shape="rect" coords="0, 0, 92, 16" alt="Click here to switch to the main discussion board.">
                      <area href="" shape="rect" coords="0, 17, 92, 33" alt="Post sensitive information here. Things that you only want members to read">
                      <area href="" shape="rect" coords="0, 34, 92, 50" alt="Share your wealth of knowledge with other avid sportsmen and shooters.">
                      <area href="" shape="rect" coords="0, 51, 92, 67" alt="The Religion SIG is ideal for in-depth discussions, debates, and group study.">
                      <area href="" shape="rect" coords="0, 68, 92, 84" alt="Trading Post">
                      <area href="" shape="rect" coords="0, 85, 92, 101" alt="Group for coordinating and planning in-person member meetings and regional assistance in case of emergencies.">
                      <area href="" shape="rect" coords="0, 102, 92, 118" alt="Indulge in 'off-the-wall' discussions and explore unexplained phenomena in the Alternative Topics Lounge">
                      <area href="" shape="rect" coords="0, 119, 92, 135" alt="A place for members to express themselves through creative writing and storytelling">
                      <area href="" shape="rect" coords="0, 136, 92, 152" alt="Comm/Tech/PC Help">
                      <area href="" shape="rect" coords="0, 153, 92, 169" alt="A lightly moderated forum where members can 'let it all hang out'">
                      <img border="0" src="" usemap="#tb2kmapvert" width="92" height="169" align="center"></td>
                            <td width="590" align="center">
                            <img border="0" src="" align="center" width="587" height="176"></td>
                      The above code is placed in the HEADER template (for this example). For reference, below is attached the actual static gif that gets mapped.
                      Attached Files
                      Last edited by Dennis Olson; Thu 30 Dec '04, 10:48am.


                      • #12
                        no no, i mean this:


                        when the header is loading, do you notice that there are different gifs being loaded to make one banner, not just one single whole?


                        • #13
                          Yeah I understand. You're talking about the $navbar at the bottom of your image, right?


                          • #14
                            What exactly do you want to do then? One logo that changes with each pageload or that changes while the page is being displayed? Because that JS code does the latter.


                            • #15
                              one logo that changes with each pageload

                              i am talking about the are where it says


                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.