Wouldn't you like to know how many people have read your blog post? Well, I do like so. In the blog system mangoBlog, which I use for this weblog, this wasn't a default option, and there wasn't a plugin yet to add this.
So, I created a plugin. You will already see the words "view Count: x" underneath this blog text.
What's new in:
See changes in subversion
Version 1.4
Added new admin setting "view count text", so you can now decide what viewcount text you want to show in your website.
Version 1.3
Added new admin setting "show count in weblog?" to optionally hide your view counts.
The viewcounts are now also shown on the Posts overview page! Thanks to Mark Aplet for the tip!
Version 1.2.5
Zipped the outdated version of settingsForm.cfm in 1.2.4. this version fixes that.
Version 1.2.4
Fixed a bug with the latest version of mangoblog, which prevented the plugin from working.
Version 1.2.3
Less database interaction because of caching.
Support for MySQL as well as MSSQL!
Admin-problem resolved for implementations which use a table-prefix with their database tables.
How to use?
Go to your mangoBlog admin > Plugins, and enter the following url to download: http://www.railodeveloper.com/viewCount/viewCount-plugin-Mangoblog-v1.4.zip
Then, you need to activate it by pressing the link 'Activate' next to the plugin.
The settings
You can control the plugin in 3 4 5 ways, reached from the Settings page in your mangoBlog admin.
- "Count views from web spiders/crawlers?" Default: No.
These are page requests done by search engines like Google, to index your website. To be honest, these aren't real views, but on the other hand, it IS a request. - "" Default: 2 hours.
ViewCount remembers the time and IP address for each counted view. After how many hours should we consider a page view from the same IP to the same post a new view? - "Show viewCount in website?"
In case you want to hide the view count from the public. - "Text to show"
By default, the plugin will show "View count: 123". Here, you can change the text which will be shown.
You can use a placeholder for the viewcount number by adding $viewcount$.
Examples: "viewed $viewcount$ times", "$viewcount$ views", or "| $viewcount$ keer bekeken".
If you leave the $viewcount$ out, then it will be added to the end of the text. And yes, you can add html - You can change the counts yourself.
If you already have your blog for years, and don't want to look like a lonely idiot with no visitors at all, then just start off with a higher number.
Are the counts not working/showing up on your pages?
That will probably have to do with your template/Theme. Check if your post.cfm-template (found in /skins/template-name/) contains a tag <mango:Event name="beforePostContentEnd" />. If not, then just copy and paste this tag into the div at the end of the post, just after the "Posted by ..." text.
Want to show the view count on the index pages as well?
As you can see on my homepage and archive pages, the view count is show for each post. To accomplish this, you need to edit the 2 templates index.cfm and archives.cfm, both in your Theme directory. Just add the following text near the "Posted by ..." line:
<mango:Event name="showViewCount" />
The code itself
- Plugin.xml (view source)
- PluginHandler.cfc (view source)
- admin/settingsForm.cfm (view source)
- Or download the full package
Links
When you're using the plugin, and/or have any questions, leave me a comment! I'd like it ;-)
| Viewed 1381 times






#1 by John Sieber - January 23, 2010 at 11:42 PM
#2 by philipholmes - January 24, 2010 at 6:41 AM
#3 by Paul Klinkenberg - January 24, 2010 at 1:55 PM
#4 by John Sieber - January 24, 2010 at 8:38 PM
#5 by Paul Klinkenberg - January 25, 2010 at 12:35 PM
#6 by John Sieber - January 26, 2010 at 3:52 AM
#7 by John Sieber - January 28, 2010 at 5:01 AM
#8 by Paul Klinkenberg - January 28, 2010 at 11:52 AM
#9 by John Sieber - January 28, 2010 at 4:35 PM
#10 by John Sieber - January 29, 2010 at 6:35 AM
#11 by PO Chassay - February 13, 2010 at 12:28 PM
#12 by John Gag - February 16, 2010 at 7:31 PM
#13 by Mark Aplet - February 18, 2010 at 6:26 PM
#14 by Paul Klinkenberg - March 11, 2010 at 1:16 AM
#15 by Snake - May 23, 2010 at 12:24 AM
#16 by snake - May 23, 2010 at 12:31 AM
#17 by Brandon moser - August 20, 2010 at 4:25 AM
#18 by Paul Klinkenberg - August 21, 2010 at 1:32 AM