Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogblog questionblog question
Previous
 
Next
New Post
2/6/2009 3:55 PM
 

I would like to have the latest blog article on my side nav on all pages. is there a gui way to do this or do I need to run a query on the database and print out the results?

 

 
New Post
2/7/2009 5:35 AM
 

Hi Lorddog,

you may rely on an instance of the original EntryController class, and use it to retrieve an ArrayList of EntryInfo objcets. You then need to bind the data to your control and evaluate the Title property.

Best regards,
Dario Rossa

 
New Post
2/9/2009 2:13 PM
 

Dario,

Thx I didnt quite understand what to do at first until I downloaded the source code for the blog. I then looked at the viewblog.ascx.vb file and picked out the pieces I needed. It turns out all I needed is the import

Imports

DotNetNuke.Modules.Blog.Business

and then in my page load sub I used this to get the latest blog object

 

 

list = objEntries.ListAllEntriesByPortal(

 

Dim objEntries As New EntryControllerDim list As ArrayListMe.PortalId)Dim oBlog As BlogInfo = Nothing

 

If list.Count > 0 Then

oBlog = list.Item(0)

 

End If

then with the oBlog object I have all the data on that blog to write out to my page.

Lorddog

 
New Post
2/9/2009 2:35 PM
 

messed that up. its not a bloginfo object but an entryinfo object so here is the correct code I used

Imports DotNetNuke
Imports System.Web.UI
Imports DotNetNuke.Modules.Blog.Business

Namespace Modules.ModuleName
   Partial Class ViewBlogView
      Inherits Entities.Modules.PortalModuleBase

      Protected sEntryTitle As String = ""
      Protected sEntryText As String = ""
      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         Dim objEntries As New EntryController
         Dim list As ArrayList
         list = objEntries.ListAllEntriesByPortal(Me.PortalId)
         Dim oEntry As EntryInfo = Nothing
         If list.Count > 0 Then
            oEntry = list.Item(0)
            sEntryTitle = oEntry.Title
            sEntryText = oEntry.Description
         End If
      End Sub
   End Class
End Namespace

 
New Post
2/10/2009 2:39 AM
 

Hi Lorddog,

well done, thank you for posting your code, this may help other developers too. One only thing: you are fetching all the entries from the database, but you use only 2 fields of the last entry: this may result into an heavy usage of the database where only few data is required. You should consider using LinqToSql to fetch only the 2 fields and select only the last entry matching your PortalID criterium. If you don't feel confortable with LinqToSql, you can use the EntryController.ListEntriesByPortal method, that allows a RecentEntriesMax parameter to be added into the signature. Your database would be thankfull.

Best regards,
Dario Rossa

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogblog questionblog question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out