DZone Badge Extension for BlogEngine.NET

by Bill Beckelman 21. October 2008 06:10

Overview

This BlogEngine.NET extension will add a DZone badge to your posts which have a category you have designated to automatically receive a badge. Overrides and options are provided through tokens. If you are not familiar with badges, they are nice because they allow the person reading your post to vote your post up or down without having to return to the parent site (in this case DZone) to do so.

History

I initially created an extension very much like the DotNetKicks extensions that are floating around for BlogEngine.NET. I asked Chris Blankenship to look over the code and he provided the suggestion to automatically add the badge according to post category instead of adding it via token like the DotNetKicks extensions do. He also provided the suggestion for the [ dzone:none ] override and cleaned up the code immensely again once things were hacked together. The suggestions and code cleanup that he has provided have been invaluable. Please take the time to look at the great extensions he has provided to the community http://www.dscoduc.com/page/MyToolbox.aspx.

Installation Instructions

Quick Instructions:

  1. Installation is the same as pretty much all of the other BlogEngine.NET extensions. Just copy the DZone.cs file to your extensions folder. Log in and then delete the categories on the manager page for the DZone extension that you do not want to automatically receive a badge. Be sure to see the Known Issues section.

Detailed Instructions:

  1. After downloading and unzipping the extension, copy the DZone.cs file to the App_Code/Extensions folder of your BlogEngine.NET installation.

    image_18

  2. Log into your blog and select Extensions from the Administration Menu.

     image_19

  3. From the list of installed Extensions that loads, find the "DZone" extension and click Edit.

     image_20

  4. Since the extension defaults to adding a DZone Badge to all of your categories, you should delete any categories where you do not want to add a Badge automatically. In this case I would delete the category "Audio Books" as I don't want anything in this category to have a badge. (Note: If you add multiple categories to a post, a badge will be added if any of the categories are set to receive a badge automatically. So if I add a post with the categories "ASP.NET" and "Audio Books", the post will get a badge even if the category "Audio Books" is not set to receive a badge.)

     image_21

  5. As you add categories to your blog, you will need to come back to the extension settings and add them if you want them to automatically receive a badge

  6. You can return to the front page of your blog as you are done :)

 

Usage Instructions

The extension automatically adds a DZone Badge to any post with a category that you have designated to receive a badge in your extension manager. The default badge is the wide badge which is 25px by 155px. You can override this default for a particular post by using tokens (just type the token into your post either in the built in editor or in whatever software you use to author your posts). The extension currently supports the following tokens:

  1. [ dzone ] - adds the default badge to a post. Use when you want to add a badge to a post that would not normally receive a badge due to its categories.
  2. [ dzone:tall ]  - adds a tall badge which is 70px by 150px to the post instead of the default wide badge. Can also be used to add a badge to a post that would not normally receive one due to its categories.
  3. [ dzone:wide ] - adds a wide badge to a post where none of the categories of the post are currently in the extension settings to automatically receive a badge.
  4. [ dzone:none ] - Overrides a post automatically receiving a badge when it normally would due to its category.

*Important: Remove the space after the opening bracket and before the closing bracket.

 

Chris Blankenship was also kind enough to provide how he is styling the badge on his own blog which you can use as a reference:

.text iframe
{
      display:block;
      float:right;
}

 

Known Issues

There is a bug in at least version 1.4.5.7 of BlogEngine.NET where trying to page the GridView in Extension manager throws the error "The GridView 'grid' fired event PageIndexChanging which wasn't handled." This will come into play if you have more than 10 categories. The issue was reported to the BlogEngine.NET team via the CodePlex web site http://www.codeplex.com/blogengine/WorkItem/View.aspx?WorkItemId=7647. The workaround listed on the item is to increase the page size. I personally removed paging from the GridView altogether but you could certainly use the first fix or even add a PageIndexChanging event to the GridView yourself. The GridView is located in the user control at /admin/Extension Manager/Settings.ascx.

Download

I have only tested the extension with version 1.4.5.7 of BlogEngine.NET. Please let me know in the comments if it does not work with your version. I may or may not be able to help you, but by leaving a comment someone else might.

DZone.zip (1.86 kb)

Feedback

Please let me know in the comments and via the badge what you think of the extension. Let me know what can be improved or what you yourself have improved.

     kick it on DotNetKicks.com

Comments

Comments are closed

Powered by BlogEngine.NET 1.4.5.7
Theme by Mads Kristensen


About Me

I live and work in Salt Lake City, Utah. My background is in aviation. I have a degree in Aeronautical Science from Embry-Riddle Aeronautical University in Prescott, AZ. I have worked as a commercial airline pilot and most recently as a technical advisor for a charter airline.