Can we use a PHP include file for our adsense code? I wasn't sure if it would screw with the stats Google collects or anything. Or if it was against the TOS. For example, just use this where you need an ad: <?php include("includes/ad.php"); ?> whereas the ad.php file would have your googel adsensecode.
I use php include to call an external javascript file with my Adsense code... never had a problem and my code is neat and clean
Yes, PHP includes are no problem at all. PHP is all server side, so there is no difference to what the client would see, so that is all the Google cares about.
Could someone correct me if i'm wrong but shouldn't you use require_once() instead of an include as no further PHP code is to be executed in the include?
I use includes to randomize ad formats. Sure I'm not the only one too. Cant see why they'd have a problem with it.
I use includes for my navigation, which has adsense on it. I havn't had any problems and i've been a publisher for almost a year now.
i never used php include but have been using SSI with #include and never had any problem. its just like the content of your site once loads
difference between include(), include_once, require(), require_once - the include_once() and require_once() statements ensure that the code is only included once in a loop, and not repeatedly. If you were looping three times, and wanted to display the ads three times, you would use include() or require(). if you wanted to only display the ads the first time through the loop, use include_once() or require_once(). The difference between include() and require() is in the error handling. include() only raises an error warning, require() raises an error and aborts the process. In other words, require() will terminate the page if it cannot find the specified file. hth.
As others mentioned, include simply echoes the content into a specific area of the page... there is nothing wrong with using include to display adsense ads. I have been using it for years.