ross dickinson: web and desktop software developer

I just added a new fork on BlogEngine's codeplex site that adds widgets to the available areas themes have access to. Hopefully it'll get added to the main release!

Originally, BlogEngine was adding extra markup inside WidgetBase's Render method, which made it impossible to change unless you had access to the source code. That's usually not the case when dealing with theme creation. Later on, another change was made to WidgetBase that allowed it to support Photoshop image slices that only needed to be altered with CSS. While this is probably cool for a few people, this mostly just added a lot of excess markup to the final page. I'm a man who likes his markup slim, so this bugged me.

I thought it over a bit and realized that making a similar setup to the PostView/CommentView classes would allow a lot more flexibility and customizability for users. I created a class called WidgetContainer, a simple UserControl derived class thats sole purpose is to house a WidgetBase derived control. This class is easily themed by creating a WidgetContainer.ascx user control and adding it to a theme's directory.

The major benefit of this is that users can now have full control over their widget's markup without needing access to WidgetBase's source code.

To create a WidgetContainer theme, the only thing required is that it contains a control with the ID "phWidgetBody". That control only needs to derive from the Control class and allow children to be added to it. The WidgetContainer looks for this control at load time and adds its Widget instance to it.

Updates on this Site

by Ross on October 1, 2010 at 8:18 PM under ASP.Net | BlogEngine.NET

As someone who loves the .Net framework, I've been running this site using the open source project BlogEngine.NET. However, as I started actually making my own theme for the site, I started to become very aware of the project's shortcomings, bugs, and possible security flaws that currently exist. So please be aware that things may randomly break on this site as I update it from time to time to fix various things that I find broken.

And before anyone asks, I do report all the bugs I find to BlogEngine so that they'll hopefully be fixed in the rumored 2.0 release that's coming out at the end of the year! I'll post more about the bugs if/when they get fixed, cause I'd rather not make them public here.

Having said that, the upcoming release looks good. The admin section has been redesigned a bit to give it a more refined looking appearance, and it makes a lot more use of ajax/web services.

About the author

rossisdead is a 26 year old web and desktop software developer from New Jersey. He has two cats and likes long walks on the beach.

On Stackoverflow

On Stackoverflow Careers

On Codeplex

On Github