[pmwiki-users] Google adsense

Allister Jenks arj at zkarj.co.nz
Tue Dec 20 19:46:34 CST 2005


Here's what I managed to get working.  I based it on another solution (I
forget what - it was a while ago).

Insert the following at the bottom of local/config.php

Markup('AdSenseVBanner', 'directives', '/\\(:AdSenseVBanner:\\)/e',"Keep(\"
<script type='text/javascript'><!--
google_ad_client = 'pub-1234567890123456';
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = '120x240_as';
google_ad_type = 'text';
google_ad_channel ='9999999999';
google_color_border = 'CCCCCC';
google_color_bg = 'FFFFFF';
google_color_link = '000000';
google_color_url = '666666';
google_color_text = '333333';
//--></script>
<script type='text/javascript'
  src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
\")");

Markup('AdSenseHBanner', 'directives', '/\\(:AdSenseHBanner:\\)/e',"Keep(\"
<script type='text/javascript'><!--
google_ad_client = 'pub-1234567890123456';
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = '468x60_as';
google_ad_type = 'text';
google_ad_channel ='9999999999';
google_color_border = 'CCCCCC';
google_color_bg = 'FFFFFF';
google_color_link = '000000';
google_color_url = '666666';
google_color_text = '333333';
//--></script>
<script type='text/javascript'
  src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
\")");

Note the specifics of all the brackets and quotes, as distinct from the code
generated by Google.  You'll also need to put appropriate publisher and
channel ids in there and select suitable colours.

Then anywhere in your pages or templates, just put a (:AdSenseHBanner:) or
(:AdSenseVBanner:) for a horizontal or vertical banner respectively.  Once
you've got that working it should be pretty straightforward to adapt the
solution to work for other AdSense block types, or to change colours etc.
Try generating the code from Google and see the subtle differences that need
to be specified in the PHP version (above) and you'll have no troubles doing
exactly what you need.

A working example of this is at http://tawa.location.org.nz/

Hope this helps.

On 12/20/05, Phil Seyer <weddingdj at gmail.com> wrote:
>
> Is here anyway to add Google Adsense code to a pmwiki website so that
> adwords will be displayed?
>
> For example:
>
> <script type="text/javascript"><!--
> google_ad_client = "pub-xxxx";
> google_ad_width = 120;
> google_ad_height = 600;
> google_ad_format = "120x600_as";
> google_ad_type = "text_image";
> google_ad_channel ="";
> //--></script>
>         <script type="text/javascript"
>   src="http://pagead2.googlesyndication.com/xx.js ">
> </script>
>
> The above is an example only and is not real, working code.
>
> Thanks,
>
> Phil
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>
>
>
--
Allister
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20051221/b9eea6c0/attachment.html 


More information about the pmwiki-users mailing list