January 15, 2010: Updated the contents of this blog post, because of version 1.1!
Version 1.1.1: added a warning about the adsense maximum of 3 ads on one page.
What it does is pretty simple: it displays advertisements on your weblog. On my own blog here, you can see them above this full post, and inbetween the excerpts on the index and archive pages.
There are 2 configuration options besides adding the adsense code itself.
One is "On which iterations should the advertisements be shown?". This setting is usefull when you want to show ads inbetween some of the blog excerpts, but not all.
A value of "1,3,5" will show ads on the first, third, and fifth time the plugin is called.
You can leave this setting empty, so it will display ads on every call.
Note: this setting is not used for the event 'After a full blog post', because that event does not have iterations.
The other is "Show where". For now, there are 2 choices:
- "after a full blog post". When choosing this, the ads will be shown underneath a full blog post (on the /post.cfm page).
- "when the custom event 'showAdsense' is called". You will have to edit your templates (skin) for it; more info can be read underneath.
How to install
First, you need to add the plugin. Go to mangoBlog admin > Plugins > Add the following url: http://www.railodeveloper.com/adsense-plugin-mangoblog/adsense-plugin-mangoblog-v1.1.1.zip
Now click on the 'Activate' link next to the plugin 'adsense 1.1.1'. A message will appear to configure the plugin.
Off course you need to create the adsense code at http://adsense.google.com/, and then you can add it to the settings page.
Creating extra places for the adsense code to show up
By default, the ads will only be shown after a full blog post.
If you want to show the ads on other pages and/or places as well, then you need to paste the following code into your template(s):
<mango:Event name="showAdsense" />
The template files can be found in [your website root]/skins/[your template name]/
The ads are surrounded with a div with class "adsensecode": <div class='adsensecode'>...your ad ...</div>
So you can use standard css to add borders, margins, etc.
- plugin.xml is the config file (view source)
- pluginHandler.cfc does all the work (view source)
- admin/settingsForm.cfm is... the admin settings form (view source)
- Download the whole package: Version 1.1.1
If you're using it, or have a question, let me know by leaving a comment!| Viewed 3681 times