Forum Moderators: martinibuster

Message Too Old, No Replies

How to get the Adsense code into a .php file

         

Jettie

8:47 am on Feb 26, 2004 (gmt 0)

10+ Year Member



I own a classifed ad site and I want to run Adsense on it.
The problem is: Adsense codes are not alowed on search result and welcome pages etc, so I can't put it in the header (wich is html ... and easy for me) because then, they show up on EVERY page.
I have to put the codes on the detail pages only, wich are all .php files.
I'm a php-dummie, so can anyone help me out here?

Fischerlaender

10:34 am on Feb 26, 2004 (gmt 0)

10+ Year Member



Just put your Adsense code in its own file and include (PHP function include()) this file in any page the Adsense ads should be displayed.

adsense.inc.php:

<script language ...
.. your Adsense Code ..
</script>

htmlpage.php:

<?php include("adsense.inc.php");?>

creepychris

1:18 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



i had the same problem with phpbb2, but instead of inserting it into the header, i just inserted into the forum and topic templates. That way it doesn't appear in the search and login pages. I don't know what you are using, but if you have a few particular templates that get called a lot (and don't violate the TOS like search pages) that might be all you need.

Jettie

1:32 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



Thanx all ... I will give it a try.
I use Noah Classified.

JohnKelly

2:33 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



I thought AdSense was allowed on search results now, with the last change of their TOS (?)

jonathanleger

2:50 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



Yup, you can show AdSense on search results now.

Jettie

3:33 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



Ok, on search result pages.

But I got a warning email from Google ...!
I had to delete the code from any , pop-up, pop-under, welcome page, error page, or pages with no or little content immidiately!

I did so offcourse, because the code was in the header and that means on the welcome page (with no content) too ...