Translations of this page?:

Incorporating Google AdSense ads in a wiki

The felixibility of DokuWiki lends itself to all sorts of applications, including blogs and CMSs. Some wiki owners have integrated contextual advertising into their wiki, the most popular being Google AdSense.

Mostly this is a simple matter of including Google's code in your DokuWiki template. But Google's terms and conditions disallow the placing of adverts on some pages, including registration and login pages.

Adding Adsense to your wiki

by adsense plugin

You could use this plugin to integrate adsense into your wiki. It does not allow to include adsense into wiki content yet, but this feature will come.

by phpinc plugin

You can also use the phpinc plugin to include the advertising code inside contents. To only show adsense advertising on “normal” page views, check the content of the global $ACT variable and only print the adsense code when it is set to show:

<?php if($GLOBALS['ACT'] == 'show'){ ?>
<script type="text/javascript"><!--
google_ad_client = "pub-5892664235245840";
google_alternate_color = "303538";
google_ad_width = 180;
google_ad_height = 150;
google_ad_format = "180x150_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "282C2F";
google_color_bg = "282C2F";
google_color_link = "1C86EE";
google_color_url = "1C86EE";
google_color_text = "222222";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php } ?>

Note: the $ACT is accessed using $GLOBALS to avoid redeclaring it with global scope modifier.

 
wiki/discussion/google_adsense.txt · Last modified: 2007/12/13 22:50 by 76.123.120.101
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate