Welcome to WebmasterWorld Guest from 18.206.48.142

Forum Moderators: martinibuster

Message Too Old, No Replies

Can some one show me how to add google adsense to my site using php.

     
6:37 am on Mar 31, 2006 (gmt 0)

New User

10+ Year Member

joined:Mar 31, 2006
posts:12
votes: 0


Can some one show me how to add google adsense to my site using php. i mean i went to this site <snip>, and they are somehow syndicating yahoo ads. how would i do the same thing for google ads?

[edited by: trillianjedi at 3:59 pm (utc) on Mar. 31, 2006]
[edit reason] No URL's please as per TOS. [/edit]

7:20 am on Mar 31, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 20, 2004
posts:882
votes: 2


/* php stuff */?>

AdSense Code

<? */ back to php */

9:40 am on Mar 31, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 24, 2005
posts:121
votes: 0


--------------
ads.inc
--------------

Adsense code here


--------------
All your other pages you want ads on
--------------

<? include_once("ads.inc");?>

3:37 pm on Mar 31, 2006 (gmt 0)

New User

10+ Year Member

joined:Mar 31, 2006
posts:12
votes: 0


Thx for your replies, but i am a newbie with php and mysql. mygen it looks like your talking mysql? If you could please do me a favor and explain it in lamens terms. i know html really well and i hear php isnt hard to learn. what i mean is that it looks like he actually uses a script or something to pull in specific keywords and then the script grabs the right ads from yahoo. please look at this guys/girls site and view the source if you dont know what i mean.
3:50 pm on Mar 31, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 5, 2006
posts:174
votes: 0


Ballhogjoni, it's as simple as this...

Your PHP code is enclosed within <?php?> tags, and your HTML goes outside the tags, like this:

<?php
if (1 + 1 == 2)
{
// Whatever
}
?>

<!-- AdSense code (HTML) goes here! -->

<?php
// More PHP code
?>

7:20 pm on Mar 31, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 11, 2004
posts:183
votes: 0


learn.
7:59 pm on Mar 31, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Feb 12, 2006
posts:2709
votes: 116


save the google code (exactly as they supply it) onto a completely blank page.
save it as googlecode.php (or whatever you want)

and then put
<? include("googlecode.php");?>
on your main pages, wherever you want it to appear - remembering to change googlecode.php so it points to wherever it is you saved it.

you main page can either be .html .htm .php - depending on how your server is set-up.
but you won't be able to view it on your home computer unless you have apache or some other kind of server installed.
you can download apache for free on the web. just do a search.

it sounds hard but it's pretty easy. you could have it up and running within a couple of hours.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members