You are here:  » Integration of AdSense


Integration of AdSense

Submitted by IG on Wed, 2006-03-29 19:29 in

Hi David

I think somebody asked this question before, but I could simply not find the thread. In the previous distribution there was a folder "ads" with a file "product_bottom.php where Adsense could easily be integrated. In the current version I did not find this folder and wonder how to integrate Adsense that it shows as in webpricecheck?

IG

Submitted by support on Wed, 2006-03-29 19:39

Hi,

Sorry for not mentioning this yet. As you've realised, the test for include files on every page no longer exists; as I felt it was a little pointless only ever having had the one include in there. Instead; there are 2 ways that you can incorporate your own code.

Firstly, you can simply paste your required AdSense or other advertising code at the bottom of the associated /html/xxxxxx file, so to display AdSense on the bottom of the prices; you would paste the code into the bottom of html/prices.php.

However, there is an alternative method, which I use on webpricecheck.co.uk. If you study html/footer.php; you will notice the following code at the top:

if (file_exists("html/user_footer_before.php")) require("html/user_footer_before.php");

What this does is check for the file user_footer_before.php in the /html directory; and if it exists includes it into the output.

On WebPriceCheck.co.uk; I use the $_SERVER["PHP_SELF"] variable to see what page we are on; and if we're on /products.php or /reviews.php I include AdSense; like this:

html/user_footer_before.php:

<?php
switch($_SERVER["PHP_SELF"])
{
case "/products.php":
case "/reviews.php":
?>
<p>
// paste your AdSense code here
</p>
<?php
break;
}
?>

Hope this helps - I'll post more info on this in the documentation.

Submitted by IG on Wed, 2006-03-29 19:51

It definitely worked for me - thanks a lot!