phpAdsNew - Anyone Running This With vBulletin?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smoknz28
    Senior Member
    • Jul 2005
    • 121

    phpAdsNew - Anyone Running This With vBulletin?

    vBulletin v3.5
    ==========

    I run phpAdsNew and recently converted to vBulletin from Threads. I would like to know if any of you are successfully running phpAdsNew with vBulletin.

    I've read on another forum that I can go in and create a new plugin in the global_start file with the php code that I want to run on the pages....been trying that but no go.

    Oh, and yes, I am very new to this software as I've only been running vb for a couple days now so much of this chat I read is foreign to me.

    Thanks,
    Mark
    Last edited by smoknz28; Sun 2 Oct '05, 1:19am.
  • smoknz28
    Senior Member
    • Jul 2005
    • 121

    #2
    I've added both php and javascript in the global_start file...but I can't get either to work. Here's what I put in there in php:

    <?php
    if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) {
    if (!isset($phpAds_context)) $phpAds_context = array();
    $phpAds_raw = view_raw ('zone:3', 0, '_blank', 'http://ws6store.com', '0', $phpAds_context);
    echo $phpAds_raw['html'];
    }
    ?>

    How can I get this to appear on the header of each of my pages?

    Comment

    • ampersand
      Senior Member
      • Mar 2005
      • 308
      • 4.0.0

      #3
      I'm using the javascript and have placed it in my header. I just needed a layer to pop up once in a while.

      Not sure about the php code, but I think you need to alter it somehow

      Comment

      • ManagerJosh
        Senior Member
        • Jun 2002
        • 9922

        #4
        Here's a thought...why not just use the remove invocation code (IFRAME or Javascript) and put it in your templates?
        ManagerJosh, Owner of 4 XenForo Licenses, 1 vBulletin Legacy License, 1 Internet Brands Suite License
        Director, WorldSims.org | Gaming Hosting Administrator, SimGames.net, Urban Online Entertainment

        Comment

        • smoknz28
          Senior Member
          • Jul 2005
          • 121

          #5
          Mmmm ManagerJosh, these darn templates are kicking me in the tail.... I'm new to this vBulletin stuff.

          Please see my post in this thread:

          Hi i am a graphic designer and i know a little about web design but nothing of php. I need somebody to create a forum for me that looks has the same style/consistency to the rest of my site. Attached is a jpeg of an example of what colors need to be used. I can pay for this to be done, i can also provide all the images/info.


          Maybe it would be easiest if someone could edit the header code I pasted in that thread with the php or javascript for my phpAdsNew....then I may better understand it for the rest of my ads I have to add.

          Thank you...

          Comment

          • Ace
            Senior Member
            • Apr 2004
            • 4051
            • 4.2.X

            #6
            Take the <php wrappers out from the top and bottom.

            Here's what mine looks like:
            PHP Code:
            if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
                    if (!isset(
            $phpAds_context)) $phpAds_context = array();
                    
            $phpAds_raw view_raw (''3'''''0'$phpAds_context);
              echo 
            $phpAds_raw['html'];
                } 
            Then, stick
            Code:
            $phpAds_raw[html]
            where you want it to display.
            My Live vB5 Site - NZEating.com
            vBulletin Hosting | vBulletin Services - Need hosting for your vB? Need it installed? Something else? Let me take that hassle off your hands.

            Comment

            • smoknz28
              Senior Member
              • Jul 2005
              • 121

              #7
              Seriously...there's gotta be something along the way here that I just can't seem to follow....

              K, went into my header template through the AdminCP....and I deleted everything that was in the file code and added this code and there is only this code in the header template:


              if (@include(getenv('DOCUMENT_ROOT').'/phpadsnew/phpadsnew.inc.php')) {
              if (!isset($phpAds_context)) $phpAds_context = array();
              $phpAds_raw = view_raw ('zone:9', 0, '_blank', 'http://www.g-forcesuspension.com', '0', $phpAds_context);
              echo $phpAds_raw['html'];
              }


              Clicked the save button and I get this error:


              The following error occurred when attempting to evaluate this template:

              Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/smoknz28/public_html/forums/includes/adminfunctions_template.php(3519) : eval()'d code on line 4

              This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.




              Why is this soooo complicated for me.....? Argh.....

              Comment

              • Ace
                Senior Member
                • Apr 2004
                • 4051
                • 4.2.X

                #8
                That is the bit that goes in global_start.

                The other bit is what goes in the header. The code part.

                (This QR box is on crack.. I can't paste and random keys are jumping the page up and down...)
                My Live vB5 Site - NZEating.com
                vBulletin Hosting | vBulletin Services - Need hosting for your vB? Need it installed? Something else? Let me take that hassle off your hands.

                Comment

                • smoknz28
                  Senior Member
                  • Jul 2005
                  • 121

                  #9
                  Hahaha....man, this is incredible....I'm getting so aggravated with vBulletin and these styles and templates that I'm just about ready to go back to Threads....though I know I'd not be happy either....but atleast it was cake for me to make changes.

                  With vBulletin....I guess I just don't have the fundamentals down here which is making it difficult for me to comprehend much of this that goes on with styles and templates.

                  Now, I can't even recall how I got into global_start Sheeeesh....

                  Comment

                  • TheMusicMan
                    Senior Member
                    • Oct 2002
                    • 2140
                    • 3.7.x

                    #10
                    I use phpAdsnew on my vB forum - have done so for years.

                    Why not just get phpAdsNew to generate an invocation code and place this code in a <td> or <div> wherever you want the banners to appear... simple... don't know what the problem is.
                    John

                    Comment

                    • smoknz28
                      Senior Member
                      • Jul 2005
                      • 121

                      #11
                      Well, would you lookie here....

                      I found the global_start and did what you said...then set the other code in the header...and whammo!

                      Thank you for your patience...now I just got to get the header to clean up. Here's what it looks like: www.f-bodyhideout.com/forums

                      I'll be adding more banners as well with the phpAdsNew code. Hopefully I can figure it out....

                      Please give me pointers if you don't mind.

                      Comment

                      • smoknz28
                        Senior Member
                        • Jul 2005
                        • 121

                        #12
                        Originally posted by TheMusicMan
                        I use phpAdsnew on my vB forum - have done so for years.

                        Why not just get phpAdsNew to generate an invocation code and place this code in a <td> or <div> wherever you want the banners to appear... simple... don't know what the problem is.
                        Yea, the problem is partly due to my ignorance with code.... I have been using the invocation code. The problem I was having is where to place the php code or javascript. I finally did it but that was having to edit two seperate files...if you got an easier way, then please break it down barney-style for me please. This has been on my nerves....please remember, I've only been using vBulletin for the past couple of days. It's all new to me.

                        Comment

                        • tgreer
                          Member
                          • Oct 2005
                          • 50

                          #13
                          I'm in exactly the same situation. Here's what I've done so far. In the "global.php" file, I've added the lines in red:

                          Code:
                          // identify where we are
                          define('VB_AREA', 'Forum');
                          
                          define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
                          
                          // #############################################################################
                          // Start initialisation
                          require_once(CWD . '/includes/init.php');
                          [COLOR=Red] require('../adserver/phpadsnew.inc.php');
                          
                           if (!isset($phpAds_context)) $phpAds_context = array();
                           $phpAds_raw = view_raw ('', 0, '', '', '0', $phpAds_context);
                          [/COLOR]  
                          
                          $vbulletin->input->clean_array_gpc('r', array(
                              'referrerid' => TYPE_UINT,
                              'postid'     => TYPE_UINT,
                              'threadid'   => TYPE_UINT,
                              'forumid'    => TYPE_UINT,
                              'pollid'     => TYPE_UINT,
                              'a'          => TYPE_STR,
                              'mode'       => TYPE_STR,        // Threaded mode // may conflict with other 'mode' variables?
                              'nojs'       => TYPE_BOOL
                          ));
                          
                          // #############################################################################
                          I understand that this will cause the adserver init code to run, on every page of vbulletin. I also understand that it creates a variable, $phpAds_raw.

                          Now, if I follow that code with the line:

                          echo
                          $phpAds_raw['HTML'];

                          Then it does indeed display the appropriate banner ad, at the top of the page. That isn't where I ultimately want it.

                          I tried to cause the ad to display after the first message in a thread. I followed the instructions in this thread:

                          I tested the old instructions (http://www.vbulletin.com/forum/showthread.php?t=123281) on version 3.5 and they appear to work exactly the same. No changes are needed. Here are the same instructions rewritten with some improvements: Admin CP -&gt; Styles &amp; Templates -&gt; Style Manager -&gt; « » -&gt; Postbit Templates


                          Now I have a postbit template that looks like:

                          Code:
                           </div>
                          <!-- / post $post[postid] popup menu -->
                          
                          <if condition="$show['spacer']">
                              </div>
                              $spacer_close
                          </if>
                          <!-- / post #$post[postid] -->
                          
                          [COLOR=blue]<if condition="$post[postcount] == 1">
                          
                          $spacer_open
                          <div style="padding:0px 0px $stylevar[cellpadding]px 0px">
                          
                          <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
                          <tr>
                              <td class="thead" align="left">Sponsored Links</td>
                          </tr>
                          <tr>
                              <td class="alt1" align="center">
                                  [COLOR=red]BANNER CODE HERE[/COLOR]
                              </td>
                          </tr>
                          </table>
                          
                          </div>
                          $spacer_close
                          [/COLOR][COLOR=blue]
                          </if>
                          [/COLOR]
                          Now, I've tried to insert the ad variable in place of BANNER CODE HERE, but can't get anything to work. Either I get massive errors when saving, or no errors, but no banner displayed.

                          $phpAds_raw[html] causes no errors, but doesn't display the ad.

                          Any clues?

                          EDIT: The variable works in other templates, such as SHOWTHREAD. It just doesn't work within the postbit template. Why would this be?
                          Last edited by tgreer; Fri 7 Oct '05, 6:33pm.
                          Thomas D. Greer
                          www.tgreer.com/printforum

                          Comment

                          • smoknz28
                            Senior Member
                            • Jul 2005
                            • 121

                            #14
                            Yea, this is such a pain.... For once, I am disappointed in this area that I left UBB Threads. It seemed so much easier to make changes to the headers and footers of individual forums.....

                            Argh.....

                            Hopefully someone will chime in and we can get our sites to run correctly with phpAdsNew.

                            Comment

                            • tgreer
                              Member
                              • Oct 2005
                              • 50

                              #15
                              The JavaScript invocation code works, but for various reasons I want to use local invocation. That variable works in most templates, but not the postbit. I suspect it's a PHP scope issue. I'm investigating. I suspect that the postbit's are processed within a function, so the vars are not globally scoped.

                              EDIT:

                              That's the issue... the postbits are processed by insantiating a postbit factory object, which process the postbit templates via a function call. So any PHP variables inside a postbit template will be scoped to the function. That's why putting in the $phpAds_raw variable in the postbit template simply displays nothing: it isn't defined within that function, and isn't processed with the "global" keyword.

                              That means either we must use the JavaScript invocation, or "hack" the class_postbit.php program to assign "global" to any php variables within the templates. Bummer.

                              EDIT:

                              I tried using the $GLOBALS array to reference the variable, that fails as well...
                              Last edited by tgreer; Sat 8 Oct '05, 7:41am.
                              Thomas D. Greer
                              www.tgreer.com/printforum

                              Comment

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