Submit Your Article Forum Rules

Results 1 to 5 of 5

Thread: PHP and AdSense Code

  1. #1
    Junior Member WildSeeker's Avatar
    Join Date
    Nov 2003
    Posts
    27

    PHP and AdSense Code

    Greetings!

    I have been approved by AdSense (Google), and am interested in placing the code on my site pages. I had my developers place it on my index page, and they coded it as a custom footer for the index page. I would like to also place it on select pages on my site, not as a footer necessarily, and would like to do it myself.

    I can do relative simple coding on my own, but could use some guidance on placing javascript. What I am hoping for is some guidance on coding tips/examples with respect to the AdSense code and PHP.

    Any help here would be greatly appreciated.

    Regards,
    Regards,

    Tim
    WildSeeker
    The Adventure Travel Resource

  2. #2
    Senior Member
    Join Date
    Jul 2003
    Posts
    1,771
    Hi Wildseeker,

    Unfortunately, I'm not familiar with AdSense, yet.
    If you are trying to call a Javascript code from a file, you can use this
    <script language="javascript" src="somefile.js"></script>
    and if it's php
    <? include("somefile.php"); ?>
    Web Hosting Guru
    | Need Help For Your Forum?

  3. #3
    Junior Member WildSeeker's Avatar
    Join Date
    Nov 2003
    Posts
    27
    Hello Cyanide -

    Thanks for your reply. I suppose I should have copied the code here that I am looking to place. Google instructs to "copy-and-paste this HTML code into your web pages":

    <script type="text/javascript"><!--
    google_ad_client = "my client ID";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

    My question is how I place this code into my PHP files. I am familiar with using javascript in HTML pages, just a bit unsure of the intricacies of PHP in this respect.
    Regards,

    Tim
    WildSeeker
    The Adventure Travel Resource

  4. #4
    Senior Member
    Join Date
    Jul 2003
    Posts
    1,771
    HI wildseeker,

    All you have to do is put that code, exactly as it is in a file. Call the file something like adsense.php

    Then put this code:
    <? include("adsense.php"); ?>
    wherever you want the ads to show
    The adsense.php file in this code assumes you have it placed in your root directory. If, for example you have this file in a folder called extras then just change the code to
    <? include("extras/adsense.php"); ?>
    Web Hosting Guru
    | Need Help For Your Forum?

  5. #5
    Junior Member WildSeeker's Avatar
    Join Date
    Nov 2003
    Posts
    27
    Thanks Cyanide -

    I was able to get the code included with no problem. As it turned out, I was actually able to copy and paste the code, as is, directly into a table on the page I was working with.

    I appreciate your help.
    Regards,

    Tim
    WildSeeker
    The Adventure Travel Resource

Similar Threads

  1. Dynamic code in source code
    By Milo in forum Google Discussion Forum
    Replies: 4
    Last Post: 07-02-2007, 07:25 AM
  2. Official Google AdSense Blog showcases site that displays AdSense near Adult Content
    By Rado-Vleugel in forum Google AdWords/Google AdSense
    Replies: 2
    Last Post: 06-14-2007, 06:34 PM
  3. Adsense breaking the code article!
    By bbilou in forum Google AdWords/Google AdSense
    Replies: 1
    Last Post: 07-30-2006, 09:45 AM
  4. Same Adsense Code on Multiple Sites?
    By neosite in forum Google AdWords/Google AdSense
    Replies: 15
    Last Post: 08-21-2005, 07:09 AM
  5. pin code
    By arpecop in forum Google AdWords/Google AdSense
    Replies: 2
    Last Post: 05-18-2005, 03:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •