AdSense ID script on forum

Discussion in 'PHP' started by Shocka, Aug 27, 2006.

  1. #1
    Hi,

    I'm trying to put a script on a forum that would split the AdSense ads 50/50. The script is
    <?php
    $which_ad = rand (0, 1); // Generates random integer, 0 or 1
        if ($which_ad == 0) { // Kevin's awesome ad
    ?>
    <script type="text/javascript"><!--
    google_ad_client = "pub-XXX";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text_image";
    google_ad_channel ="3355115639";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "215670";
    google_color_text = "000000";
    google_color_url = "215670";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <?php
        }
        else { // Other person's ad
    ?>
    <script type="text/javascript"><!--
    google_ad_client = "pub-XXX";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text_image";
    google_ad_channel ="3355115639";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "215670";
    google_color_text = "000000";
    google_color_url = "215670";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <?php
        }
    ?> 
    Code (markup):
    I put <?php include('adsense_728x90.php'); ?> into the header.tpl file but it is not showing any ads.

    I have used this script a few times before and it has worked fine but never on a forum. Does anyone know why this is?

    Also, the forum is http://nflrivalry.com
     
    Shocka, Aug 27, 2006 IP
  2. fscripting

    fscripting Banned

    Messages:
    288
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    how will php include work in .tpl
     
    fscripting, Aug 27, 2006 IP
  3. drewbe121212

    drewbe121212 Well-Known Member

    Messages:
    733
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    125
    #3
    what forum software uses tpl?

    I know with Vbulletin you would have to use a custom hook:fetch
     
    drewbe121212, Aug 27, 2006 IP
  4. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Go to vBulletin.org.
     
    noppid, Aug 27, 2006 IP