New BlogEngine.NET Widget: Quote of the Day

-   Jan 16, 2008 -   BlogEngine.NET, Development, Screencasts -   , , ,

Quote1 I love quotes.  I enjoy seeing new quotes and I like to save them if it is handy.  I used to have a text file of quotes I collected, but it was lost in the great hard drive crash of 2007.

As I do enjoy quotes, I made a BlogEngine.NET widget for use in themes for collecting quotes and displaying a new one everyday.  I've been using it for a few months now and I'm finally getting around to sharing it with the BlogEngine.NET community.

"Uhhhh, ok, Al.  So you what exactly are you giving me?"

Great question.  I'm sharing a widget (or control) you can add to an existing theme.  Yes, this will only help someone who is interesting in working on modifying themes.  I'll likely release this theme, Refresh, with the control embedded in the coming days, but until then, you get the widget by itself.  The widget is simply a standard user control (an ascx file) and its code-behind file.

QotDWidget Let me show you how it works.  I made a short (under a minute) screencast showing you how the widget/control works.  For those, to impatient to watch or just completely sick of my screencasts, here is the text version.

As you'd expect, the widget shows you a new quote everyday from your collection of quotes.  It will pick a new quote based on when it was last displayed.  When you are logged in however, it gives you buttons to allow you to add, edit, delete, and navigate your quotes collection.  It is fairly simple.  No admin page, no hassle.  Just drop the control in your theme as you would any user control and it will work for you.

Quote2 "Wow... This is great.  I can just add this to my theme and my quotes will just magically be saved in my blog.  So where are these quotes stored?" 

Another excellent question.  To keep things simple, they are stored in an xml file in your App_Data folder.  Widget data will be provider based in the next version of BlogEngine.NET, but for now it is not.  When the widget is first run, it will find that there is no quotes.xml file and it will create it for you.

One thing I really like about this widget is that it is a simple piece of a theme.  It doesn't require you to install files in different places to use it.  I prefer to keep my blog add-ons as separate as possible from the rest of the blog.  (In other words, I think a theme should stay in its folder and not need files put in other places.  The same should go for extensions as much as possible.  This just makes updating my blog much simpler.)

This widget works fine in version 1.2 and 1.3 and can be downloaded here.


Commented on 1/24/2008 12:17:00 PM
Love your site!

I'm interested in seeing how hard it would be to modify your Quote Of The day Widget so that someone could place a snippet of HTML on their site which would then display my Quote Of The day on their site. In a sense "subscribing" to my quote of the day.

Do you have any advice on how I may implement this feature?

Thanks for ANY help!

Commented on 2/1/2008 3:17:36 PM
Thanks! I've been frustrated trying to do this from the view source page of the editor. But my theme would not allow it. This should fix that. =)
Commented on 2/1/2008 3:22:29 PM
Ahh, after watching the screencast I see this is literally a quote of the day. I thought it served as something to make quotes into images for your blog posts. Heheh....oops. Still very cool.
Commented on 2/1/2008 3:32:21 PM
Sorry for all the comments but how do I use it? I dropped the files into the User Controls folder, and tried to add it to my theme with:

      <blog:QuoteOfTheDay ID="QuoteOfTheDay1" runat="Server" />

Is that correct?
Commented on 2/5/2008 11:30:50 AM
I love your blogs & quotes
Commented on 2/13/2008 8:03:45 AM
I just wanted to say that you have a pretty informative blog and I will continue to check it out.  Have a great day.
Commented on 2/16/2008 2:23:52 AM
<blog:QuoteOfTheDay ID="QuoteOfTheDay1" runat="Server" />


You have to register the control first. For example
<%@ Register Src="~/User controls/QuoteOfTheDay.ascx" TagName="quote" TagPrefix="qotd" %>

then throw in your

<qotd:quote ID="QuoteOfTheDay1" runat="Server" />

name sure you have the right tagname and tagprefix
Comments are closed