PDA

View Full Version : PHP and AdSense Code



WildSeeker
01-27-2004, 03:19 PM
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,

cyanide
01-28-2004, 03:37 AM
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"); ?>

WildSeeker
01-28-2004, 01:04 PM
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.

cyanide
01-28-2004, 02:25 PM
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"); ?>

WildSeeker
01-29-2004, 06:58 AM
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.