Integration of phpadsnew with vb3

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RocketDawg
    New Member
    • Sep 2004
    • 11
    • 3.0.3

    #16
    Ok, I have gotten my forum to display one set of ads for the main page, and a different set of ads for each forum, forum specific.

    I am using VB3.0.3 and PHPADSNEW.

    - Using keywords in phpadsnew, assign a keyword to each banner that you want displayed in a specific forum. The keyword is the same as the forum title that you want it displayed in. (eg: forum1, forum2, etc)
    - Assign a different keyword to the index page banners (eg: "mainpage")

    Note: For whatever reason, this application only worked with javascript banner invocation. I am not a programmer, and it is beyond my capabilities to figure out how to put the php code in here, but perhaps someone else would want to. For me, the javascript invocation worked, and that is good enough for me right now.

    In the header, or wherever, the code is as follows:

    <if condition="!$forumid">

    **insert javascript invocation code generated by phpadsnew here for the main page banners, using the keyword 'mainpage' **

    </if>
    <if condition="$forumid >= 1">

    **insert javascript invocation code generated by phpadsnew here for the individual forum banners using the keyword $foruminfo[title] **

    </if>

    This method matches the name of the forum with the keyword assigned to an individual banner, and displays it.


    Here is the code in it's entirety taken from my VB header template for your reference:

    <if condition="!$forumid">
    <script language='JavaScript' type='text/javascript'>
    <!--
    if (!document.phpAds_used) document.phpAds_used = ',';
    phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

    document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
    document.write ("http://www.mysite.com/ads/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=mainpage&amp;target=_blank");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referer)
    document.write ("&amp;referer=" + escape(document.referer));
    document.write ("'><" + "/script>");
    //-->
    </script><noscript><a href='http://www.mysite.com/ads/adclick.php?n=ac58295b' target='_blank'><img src='http://www.mysite.com/ads/adview.php?what=mainpage&amp;n=ac58295b' border='0' alt=''></a></noscript>
    </if>
    <if condition="$forumid >= 1">

    <script language='JavaScript' type='text/javascript'>
    <!--
    if (!document.phpAds_used) document.phpAds_used = ',';
    phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

    document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
    document.write ("http://www.mysite.com/ads/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=$foruminfo[title]&amp;target=_blank");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referer)
    document.write ("&amp;referer=" + escape(document.referer));
    document.write ("'><" + "/script>");
    //-->
    </script><noscript><a href='http://www.mysite.com/ads/adclick.php?n=a14c4e55' target='_blank'><img src='http://www.mysite.com/ads/adview.php?what=$foruminfo[title]&amp;n=a14c4e55' border='0' alt=''></a></noscript>
    </if>


    I hope this helps someone. I have gleaned a lot of information off of support forums like this, and I only hope that this helps someone looking for a similar application.

    Thank you to Jake and Conqsoft and The Music Man for your help today.

    Comment

    • The Realist
      Senior Member
      • Jul 2001
      • 653
      • 4.0.x

      #17
      You saved me hours of trial and error M8 and your instructions worked 100%.

      Thanks.


      Originally posted by conqsoft
      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

      Comment

      • thephonemall
        New Member
        • Oct 2004
        • 21
        • 3.0.3

        #18
        Thank You!

        Thank You!

        Comment

        • John Campbell
          Senior Member
          • Nov 2004
          • 340

          #19
          phpadnew

          So I take it you guys like this software.
          But I get the impression your not using it as it was fully made fore or is it me?

          I would like input since I got the impression it was ment to be a banner ad campain software

          Comment

          • Crankin'steiN
            New Member
            • Sep 2004
            • 17

            #20
            I added the code to the phpinclude_start and I now get these errors:

            Warning: Unknown(): open_basedir restriction in effect. File(/banner1.php) is not within the allowed path(s): (/home/hardmcom:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/hardmcom/public_html/forums/global.php(394) : eval()'d code on line 8

            Warning: Unknown(/banner1.php): failed to open stream: Operation not permitted in /home/hardmcom/public_html/forums/global.php(394) : eval()'d code on line 8

            Warning: Unknown(): open_basedir restriction in effect. File(/banner1.php) is not within the allowed path(s): (/home/hardmcom:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/hardmcom/public_html/forums/global.php(394) : eval()'d code on line 8

            Warning: Unknown(/banner1.php): failed to open stream: Operation not permitted in /home/hardmcom/public_html/forums/global.php(394) : eval()'d code on line 8

            Fatal error: (null)(): Failed opening required '/banner1.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hardmcom/public_html/forums/global.php(394) : eval()'d code on line 8
            Can anyone help me with this??

            Comment

            • Jake Bunce
              Senior Member
              • Dec 2000
              • 46598
              • 3.6.x

              #21
              Use the full server path to banner1.php. For example:

              Code:
              /home/yoursite/public_html/banner1.php
              Your path will be different.

              Comment

              • John Campbell
                Senior Member
                • Nov 2004
                • 340

                #22
                Originally posted by John Campbell
                So I take it you guys like this software.
                But I get the impression your not using it as it was fully made fore or is it me?

                I would like input since I got the impression it was ment to be a banner ad campain software
                ok... I guess not.

                Comment

                • trana
                  Senior Member
                  • Apr 2005
                  • 268
                  • 3.0.7

                  #23
                  Can someone help me with this? I have followed the directions listed here.

                  Created banner.php file with php code generated from phpadsnew
                  This file displays the banner properly when called directly from a browser

                  I added the following to my phpinclude:

                  ob_start();
                  require("./images/banner.php");
                  $mybanner= ob_get_contents();
                  ob_end_clean();

                  and I added the following to my navbar template (section in bold only):

                  <div class="navbar" style="font-size:10pt"><a href="$vboptions[forumhome].php?$session[sessionurl]" accesskey="1"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions[bbtitle]</strong></div>
                  </if>
                  </td>
                  $mybanner
                  <if condition="$bbuserinfo['userid']">

                  <td class="alt2" valign="top" nowrap="nowrap">
                  <div class="smallfont">
                  <!--<span style="float:$stylevar[right]">[<a href="login.php?$session[sessionurl]do=logout&amp;u=$bbuserinfo[userid]" onclick="return log_out()">$vbphrase[log_out]</a>]</span>-->

                  The banner never seems to display properly. I have tried a few different things for the require path, ./, /, etc, nothing seems to work. I am running this on Windows 2003 IIS as an FYI.

                  Any help would be appreciated.

                  Thanks.

                  Comment

                  • Jake Bunce
                    Senior Member
                    • Dec 2000
                    • 46598
                    • 3.6.x

                    #24
                    What is the URL to the banner.php file? Does it display the banner correctly when called directly?

                    Also try using the full server path to the file in the phpinclude_start template.

                    Comment

                    • trana
                      Senior Member
                      • Apr 2005
                      • 268
                      • 3.0.7

                      #25
                      The php file works properly when called directly as a URL.

                      I tried putting in c:/inetpub/wwwroot/images/banner.php as the source and that didn't seem to work. Is my syntax correct? This is a Win2003 server with IIS.

                      Thanks.

                      Comment

                      • Jake Bunce
                        Senior Member
                        • Dec 2000
                        • 46598
                        • 3.6.x

                        #26
                        Try backslashes. Windows uses backslashes for paths:

                        c:\inetpub\wwwroot\images\banner.php

                        Comment

                        • trana
                          Senior Member
                          • Apr 2005
                          • 268
                          • 3.0.7

                          #27
                          I think I tried that originally.

                          Right now, it is:

                          ob_start();
                          require("c:\inetpub\wwwroot\images\banner.php");
                          $mybanner= ob_get_contents();
                          ob_end_clean();

                          $mybanner is in my navbar template, but it still isn't showing up anywhere.

                          Please let me know if you have any ideas what I should try next.

                          Thanks.

                          Comment

                          • Jake Bunce
                            Senior Member
                            • Dec 2000
                            • 46598
                            • 3.6.x

                            #28
                            I don't know. I might be able to figure something out from playing with it for a while. If you send me a PM with a URL and admin login to your forum, then I can take a look.

                            Comment

                            • Jake Bunce
                              Senior Member
                              • Dec 2000
                              • 46598
                              • 3.6.x

                              #29
                              You had block comments in your phpinclude_start template. This was preventing the code from executing. I removed the comments and it works.

                              Comment

                              • SixthSense
                                New Member
                                • Dec 2002
                                • 25

                                #30
                                The easiest way to get phpAdsNew working with vB3 is to follow these two steps:
                                1. Put these lines in phpinclude_start (just replace the path of phpadsnew.inc.php to reflect yours):
                                PHP Code:
                                if (@include('/your/path/to/phpAdsNew/phpadsnew.inc.php')) {
                                  if (!isset(
                                $phpAds_context)) $phpAds_context = array();
                                    
                                $phpAds_raw view_raw (''0'''''0'$phpAds_context);

                                2. Add this line wherever your want like in FORUMHOME to be displayed on the forum main page:
                                Code:
                                $phpAds_raw[html]

                                Comment

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