SunBlogNuke Team Blog

Share you with any news or development process about our dnn modules, such as status or release notes.

First time here? You may want to check out the blog archives, subscribe to the RSS feed, sign up for free email updates, or follow me on Twitter. Thanks for visiting!

From monthly archives: December 2016

We are pleased to present below all posts archived in 'December 2016'. If you still can't find what you are looking for, try using the search box.

2 Core Widgets in SunBlogNuke You Should Know

If you are a SunBlogNuke user, maybe you are missing some awesome and essential features, like ContentSlider Widget and Authors Widget. Now we would like to remind you the 2 core widget modules in SunBlogNuke you should know.

DNN-Blog-Module-ContentSlider-Author-Widget

What is ContentSlider Widget?

One utility module, enables #DNN administrator to place this module on a web page and point to a specific blog. This is a good feature to highlight one of the featured blog on a landing page to direct website visitor to the blog. It allow you to display a list of posts, like featured post and latest posts. Also you can add this widget module to any page at any time and point it to any blog on the portal.

You can visit the previous post Enhance Featured Widget Module with More Customizations and learn how to extend what you want in your dnn website.

What is Authors Widget?

Another utility module, enables DNN administrator to place this module on the blog page and display a list of authors for the blog.

Format Date Time with suffix like 1st, 2nd, 3rd, 4th

Recently some client of our DNN blog module requested a customized feature, he wanted to out the posted time of SunBlogNuke in a format that included the two letter suffix added to the day number, like "December 25th, 2009" as opposed to "December 25, 2009". After some investigation, it seems this is not supported out of the box (not surprising really). Finally I found the MarkGwilliam’s post (How To Append 'st', 'nd', 'rd' or 'th' To Day Numbers in Dates) which provided a ".NET Framework friendly" to implement this behavior and therefore offers good reuse value and is intuitive for .NET developers to use. I thought that is what we want and then extended it in our customized way which allows SunBlogNuke developers to consume the code more easily and flexible. Now I shared the VB.Net Function below and hope it helps if you also have the similar requirement:

Protected Function FormatPostedTimeWithDayNumberSuffix(Optional ByVal format As String = "MMMM d{0}, yyyy") As String
    Dim dateTime As DateTime = Date.Parse(Entry.PostedTime)
    If Not Null.IsNull(dateTime) Then
        Dim formatTime As String = dateTime.ToString(format)

        Dim day As Integer = dateTime.Day
        Dim dayFormat As String = String.Empty
        Select Case day
            Case 1, 21, 31
                dayFormat = "st"
            Case 2, 22
                dayFormat = "nd"
            Case 3, 23
                dayFormat = "rd"
            Case Else
                dayFormat = "th"
        End Select

        Return String.Format(formatTime, dayFormat)
    End If

    Return Entry.PostedTime
End Function

If you have more better or elegant solution appreciate your comments here. Thanks a lot.

Copyright © 2009-2024 Ultimate DNN Blog Module - SunBlogNuke Powered by SunBlogNuke Corp