Another approach is to add a Google AdSense banner on the top of every module. You can include the AdSense Javascript code in a separate file, call it adsense.php, and then just include this file from your module, as we did for the News sections above.

Put the following code in includes/adsense.php:

<center><script type="text/javascript"><!--google_ad_client = "your client-number";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_color_border = "FFFFFF";google_color_bg = "FFFFFF";google_color_link = "336699";google_color_url = "000000";google_color_text = "000000";//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></center>

Once you have adsense.php in the includes directory, it becomes trivial to use its code in every module you choose. For every module where you would like to add the Google AdSense, look for the following code:

require_once("mainfile.php");
and place the following line after that:
require_once("includes/adsense.php");

as we did that in the more detailed example with the News articles:

image10-3