How To - A Run.GPS Widget for BlogEngine.Net

By Bill at June 09, 2009 02:39
Filed Under: .Net Programming

RunGps WidgetOne of the great things about BlogEngine.Net is how easy it is to create widgets or plug-ins for it.

I’ve created a widget that displays the stats for a user at Run.GPS.

There are two files that go into a widget: the edit.ascx and the widget.ascx.  Both files go in a folder named for the widget.  That folder goes in the widgets folder off of the web project root.

The edit.ascx holds the code that is used to edit the settings for the widget.  The widget.ascx holds the code for the widget itself.

Run.GPS allows users to build a badge that can be embedded in a web page or blog.  The badge is configured with a series of dropdowns which change a box with HTML code at the bottom of the page.  The code is surrounded in an iframe tag. The HTML can be copied and pasted into any web page to embed the badge.

Badge Interface

For the widget to work, it should have the same settings and generate the same HTML code in an iframe tag.  A quick survey of the various settings shows that the dropdowns directly change most of the values in the HTML code.  For example, changing the “Units” dropdown to “Metric” changes to code to include “&units=Metric and changing the “Map Type” dropdown to “NORMAL” changes the code to include&mapType=NORMAL”.

The only tricky part about converting the settings to HTML code is with the width and height attributes in the HTML code.  For each badge type, there are a different set of dimensions.  Rather than spend too much time on this, I just hard coded the dimensions.

More...
kick it on DotNetKicks.com

Authors

  RSS Feed Bill Fugina

Bill is Director of Technology for Coleman Insights. He enjoys programming, software design, walking, reading, dining out and watching movies, most of which he enjoys even more when he doing them with his wife, Deb, and or his son, Isaac.  Bill and Isaac are working on a video game, but they haven't made very much progress yet.

  RSS Feed Debra Hill

Deb dabbled in Project Management in the Advertising industry for (too) many years. She has happily ditched that and is taking some time to decide what is next career-wise. She enjoys gardening, knitting, sewing and various other crafty things. She also enjoys vegetating on the weekends with the family.

RSS Feed Isaac Hill-Fugina

Isaac has his own blog called Isaac's Place.

Recent Comments

Comment RSS

Bill's Run.GPS Stats

Training Sessions 16
Total Distance 50.17 mi
Total Time 0.11:50:02
Calories 6961 kcal
Average Speed 4.24 mph
Min Altitude -157 ft
Max Altitude 590 ft
Total Ascent 226 ft
Total Descent 236 ft