Announcement

Collapse
No announcement yet.

Integration of phpadsnew with vb3

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integration of phpadsnew with vb3

    Has anyone tried it. If so, how easy was it?

  • #2
    You might get a better response on www.vbulletin.org, the official vB hacking site. We deal mostly with the default software here, not hacks.

    Comment


    • #3
      Very easy.

      Step 1
      Create a banner.php file that contains only the PHP code to show the banner (generated by phpAdsNew), enclosed in <% %>.

      Step 2
      In your phpinclude_start template, put:
      Code:
      ob_start();
      require("/full/path/to/your/file/banner.php");
      $mybanner= ob_get_contents();
      ob_end_clean();
      Step 3
      In your header template, or wherever you want the banner to appear, put:
      Code:
      $mybanner
      vBulletin v3.8.0's Implementation of Google Adsense Should Be Avoided At All Costs - Do Your Own Adsense Implementation

      Comment


      • #4
        Say I want several different banners can I just repeat that code and change $mybanner to $mybanner2 like below?

        ob_start();
        require("/full/path/to/your/file/banner2.php");
        $mybanner2= ob_get_contents();
        ob_end_clean();

        Thanks.

        Comment


        • #5
          Conqsoft,

          I have tried your method above, and have run into a snag:

          I created a php file called banner3.php :

          <?php
          if ( $foruminfo[title] == "" )
          if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
          if (!isset($phpAds_context)) $phpAds_context = array();
          $phpAds_raw = view_raw ('National', 0, '_blank', '', '0', $phpAds_context);
          echo $phpAds_raw['html'];
          }
          else
          if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
          if (!isset($phpAds_context)) $phpAds_context = array();
          $phpAds_raw = view_raw ('$foruminfo[title]', 0, '_blank', '', '0', $phpAds_context);
          echo $phpAds_raw['html'];
          }
          ?>

          Then, in phpinclude_start

          ob_start();
          require("ads/banner3.php");
          $mybanner= ob_get_contents();
          ob_end_clean();

          Then, in the header template, I placed:

          $mybanner

          My Problem / question:

          The first part of the IF stmt validates, ie it displays the "national" banner. The "else" part does not work however. Nothing displays at all.
          Is the $foruminfo[title] field even available in header template?

          Do you have any ideas why this doesn't work? I am not a programmer, I have gotten all this from reading, and PHP for dummies. I would appreciate any insight that you may have.

          Thanks in advance.

          Comment


          • #6
            I don't understand!! You don't need to amend any php files, all you need to do is to include the banner script generated by phpAdsNew into one of your template files. I have mine in the header and footer templates and it delivers ads fine.
            John

            Comment


            • #7
              I need to do the if stmt for the header banner, in order for the banner to be forum specific.

              Since the header template wont accept php, you have to do it outside, correct?

              Comment


              • #8
                Originally posted by RocketDawg
                I need to do the if stmt for the header banner, in order for the banner to be forum specific.

                Since the header template wont accept php, you have to do it outside, correct?
                Then you need to have two different banner.php files and do your IF inside the vbulletin template; loading whichever one you want.

                The code inside banner.php won't be aware of any vBulletin variables, so you can't do the comparison there.
                vBulletin v3.8.0's Implementation of Google Adsense Should Be Avoided At All Costs - Do Your Own Adsense Implementation

                Comment


                • #9
                  But how can you do an "if" stmt in the header, if the header template wont accept php?


                  Will the header template accept it if I insert

                  <?php

                  if.. blah blah

                  ?>

                  Comment


                  • #10
                    I'm no expert, but the header template accepts vB if conditionals and can easily check for a specific forum.
                    John

                    Comment


                    • #11
                      any chance you could give me a short example to get me started?

                      Comment


                      • #12
                        Originally posted by RocketDawg
                        any chance you could give me a short example to get me started?
                        An example to check for a forum?

                        Code:
                        <if condition="$forumid == X">
                        	CODE HERE
                        </if>
                        Where X is the forumid of the forum for which you want to check.

                        Comment


                        • #13
                          Thank you Jake, I will play with it for a while now and see what I can come up with. Just to check my syntax,

                          <if condition="$forumid == ">
                          CODE HERE
                          </if>

                          Will that check for a blank forum id #?

                          Comment


                          • #14
                            Use this code to check for "no forumid":

                            Code:
                            <if condition="!$forumid">
                            	CODE HERE
                            </if>
                            A forumid is defined on all of the main pages within a forum (forumdisplay, showthread, newthread, newreply).

                            Comment


                            • #15
                              Perfect, that is what I needed. The point is that on the main index page, there is no forum ID, and there I wish to display one set of banners, and then inside the forums, I wish to display a different set of banners.


                              I will come back later and post up if I am successful, because I have seen many similar questions.

                              Thanks Jake and all.

                              Comment

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