Unconfigured Ad Widget

Collapse

Programing help needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kestryll
    Head Janitor
    • Oct 2005
    • 21584

    Programing help needed

    Calguns has run on vBulletin for 12 years now, mostly on the 3.x.x version. It's past time to update to at least vB4, in order to keep vB3.x.x alive we've had to make some odd tweaks and such to the servers and it's getting more difficult.

    The two hold ups have been making sure iTrader would work on vB4, it's an old and unsupported mod, and getting the advertising to work.

    I can make iTrader work in vB4, it runs and functions whether it will transfer current ratings to a new install is anyone's guess.

    What I am having problems with is the advertising, vB4 makes some fundamental changes that the current process can not adapt to.
    Currently the ads make use of the 'random' setting in php to present ads in each cell from a specific list, vB4 no longer supports php random so the current system can not work.

    What I need is something with a table similar to what is at the top of the page with different sections displaying linked banners in a random order that allows me to add and removed linked banners as advertisers come and go.
    Banner images are stored on the Calguns server and the display code would be placed in an advertising header space that vB4 has as an integral part of the software. We currently have two rows of eight spaces at 120x60 however we are looking at going to 2 or three rows of 5 at 234x60, keeping the same or similar height for the overall table but allowing for larger banners.

    The advertising is essential to paying for the hosting costs as well as for supporting efforts like CGSSA classes and outreach programs so I can't upgrade unless I have a verified way of continuing with them.

    I have no idea what something like this costs or what to expect in that regard but we'll see...
    sigpic NRA Benefactor Life Member / CRPA Life Member / SAF Life Member
    Calguns.net an incorported entity - President.
    The Calguns Shooting Sports Assoc. - Vice President.
    The California Rifle & Pistol Assoc. - Director.
    DONATE TO NRA-ILA, CGSSA, AND CRPAF NOW!
    Opinions posted in this account are my own and unless specifically stated as such are not the approved position of Calguns.net, CGSSA or CRPA.
  • #2
    wes.crockett
    Member
    • Jun 2014
    • 193

    It's been quite a while since I've done anything like this, but I can think of a way it can be done...

    How is advertisement data stored? I assume there is a table in the database that contains fields for image location, image alt text, and pointer URL?

    Would larger banners be just larger horizontally, or vertically too? Either way, I believe values would need to be stored in order to identify sizes for them.

    Finally, did you happen to ask about this on the vBulletin site? Perhaps someone has already invented this wheel for vB4.

    Comment

    • #3
      oktavist
      Member
      • Aug 2015
      • 391

      vB4 no longer supports php random so the current system can not work.
      It would be simple to implement your own rand function.
      Most rand implementations just use something like this.

      Only take you a few lines of code.
      Calguns Lurker

      Comment

      • #4
        wes.crockett
        Member
        • Jun 2014
        • 193

        Originally posted by oktavist
        It would be simple to implement your own rand function.
        Most rand implementations just use something like this.

        Only take you a few lines of code.
        The rand function itself would be easy, but he also wants the ability to support adds that take up 2, 4, (more) of the predefined tile spaces... That functionality would be FAR more difficult.

        Comment

        • #5
          Cincinnatus
          Senior Member
          • Mar 2008
          • 704

          Have two rows of tiles, one row is the length of two or three small tiles, the other row being small tiles.

          I'm not a programmer, more of a systems analyst, but that's how I'd do it.
          Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
          http://www.thepolemicist.net/2013/01...t-for-gun.html
          https://www.thereligionofpeace.com/

          Comment

          • #6
            wes.crockett
            Member
            • Jun 2014
            • 193

            Originally posted by Cincinnatus
            Have two rows of tiles, one row is the length of two or three small tiles, the other row being small tiles.

            I'm not a programmer, more of a systems analyst, but that's how I'd do it.
            That could work, assuming they want to handle something so statically set. It would be easier to do this, though.

            Comment

            • #7
              oktavist
              Member
              • Aug 2015
              • 391

              Oh, multiple sized adds at once that all fit together. I get it now. That's much more fun.

              You will need a fitting algorithm that can reject an ad if it's to big for the remaining space, or a selection algorithm that will only pick a random ad that is guaranteed to fit. The implementation details will depend upon the actual allowed ad sizes you want.
              Calguns Lurker

              Comment

              • #8
                Cincinnatus
                Senior Member
                • Mar 2008
                • 704

                I'm patting myself on the back over here.
                Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
                http://www.thepolemicist.net/2013/01...t-for-gun.html
                https://www.thereligionofpeace.com/

                Comment

                • #9
                  wes.crockett
                  Member
                  • Jun 2014
                  • 193

                  Yeah, the easiest way would to have set grid sizes... i.e: If you wanted a total height of 3 and width of 6, you could have them arranged like below in a very static method... There are three different sizes below. You would just need each cell to have a call to the database and the table would need a static value indicating the size of the image. That size would be specified in a filter when calling for a random ad.

                  Comment

                  • #10
                    UEDan
                    Member
                    • Jul 2016
                    • 164

                    Any specific version of vBulletin 4?
                    Where are the current ads?

                    Comment

                    • #11
                      Kestryll
                      Head Janitor
                      • Oct 2005
                      • 21584

                      Originally posted by UEDan
                      Any specific version of vBulletin 4?
                      Since this would be an initial install I'd go with the most recent version, might as well get a jump on the inevitable updates..

                      Where are the current ads?
                      Funny you should mention that, I was just about to post them!
                      These have been somewhat 'genericized' to protect the innocent...

                      This is the code that is inserted in to the vBulletin Header Template:
                      <table
                      style="width: 978px; height: 122px; text-align: left; margin-left: auto; margin-right: auto;"
                      border="2" cellpadding="0" cellspacing="0">
                      <tbody>
                      <tr>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner11[$random_number11]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner12[$random_number12]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner13[$random_number13]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner14[$random_number14]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner15[$random_number15]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner16[$random_number16]</td>
                      <td style="width: 120px; text-align: center; height: 60px;">$random_banner17[$random_number17]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner18[$random_number18]</td>
                      </tr>
                      <tr>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner19[$random_number19]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner20[$random_number20]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner21[$random_number21]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner22[$random_number22]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner23[$random_number23]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner24[$random_number24]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner25[$random_number25]</td>
                      <td style="height: 60px; width: 120px; text-align: center;">$random_banner26[$random_number26]</td>
                      </tr>
                      </tbody>
                      </table>
                      This is the code for the plugins in the Header:
                      $random_number16 = rand(1, 3);

                      $random_banner16[1] = '<a href="http://www.vendor1.com/" target="_blank"><img src="/images/ads16/vend1120x60.gif" alt="" border="0" /></a>';
                      $random_banner16[2] = '<a href="http://www.vendor2.com/" target="_blank"><img src="/images/ads16/vend2120x60.gif" alt="" border="0" /></a>';
                      $random_banner16[3] = '<a href="http://www.vendor3.com/" target="_blank"><img src="/images/ads16/vend3120x60.gif" alt="" border="0" /></a>';
                      sigpic NRA Benefactor Life Member / CRPA Life Member / SAF Life Member
                      Calguns.net an incorported entity - President.
                      The Calguns Shooting Sports Assoc. - Vice President.
                      The California Rifle & Pistol Assoc. - Director.
                      DONATE TO NRA-ILA, CGSSA, AND CRPAF NOW!
                      Opinions posted in this account are my own and unless specifically stated as such are not the approved position of Calguns.net, CGSSA or CRPA.

                      Comment

                      • #12
                        Marauder2003
                        Waiting for Abs
                        CGN Contributor - Lifetime
                        • Aug 2010
                        • 3008

                        Please consider an automatic photo resizer to the board. Like
                        #NotMyPresident
                        #ArrestFauci
                        sigpic

                        Comment

                        • #13
                          Cincinnatus
                          Senior Member
                          • Mar 2008
                          • 704

                          Originally posted by wes.crockett
                          I was thinking something along these lines:
                          Attached Files
                          Active Army 1976-1986, Army Reserve 2005-2015, Afghanistan 2010-2011
                          http://www.thepolemicist.net/2013/01...t-for-gun.html
                          https://www.thereligionofpeace.com/

                          Comment

                          • #14
                            reverser
                            Senior Member
                            • Dec 2009
                            • 710

                            What makes you say this? Have you properly preregistered your variable? What hook are you using? Are you getting any output at all from the template?

                            Originally posted by Kestryll
                            What I am having problems with is the advertising, vB4 makes some fundamental changes that the current process can not adapt to.
                            Currently the ads make use of the 'random' setting in php to present ads in each cell from a specific list, vB4 no longer supports php random so the current system can not work.
                            Originally posted by sfarchitect
                            The days of scared old white people, terrified that life and the world has passed them by running America is coming to a close.

                            Comment

                            • #15
                              Cokebottle
                              Seņor Member
                              CGN Contributor - Lifetime
                              • Oct 2009
                              • 32373

                              Originally posted by Kestryll
                              it's an old and unsupported mod,
                              Ivanimal is stepping down?
                              - Rich

                              Originally posted by dantodd
                              A just government will not be overthrown by force or violence because the people have no incentive to overthrow a just government. If a small minority of people attempt such an insurrection to grab power and enslave the people, the RKBA of the whole is our insurance against their success.

                              Comment

                              Working...
                              UA-8071174-1