This project is read-only.

Updating the N2Blog

Topics: Developer Forum, Project Management Forum, User Forum
Jan 16, 2009 at 5:23 AM
Hello All,

              I am trying to update the n2Blog  So it will work with the most up to date version of N2. There are to area's i have not been able to get to work with N2.

First is the blog Factory I am not sure that it is still necessary.  If it is why and how should I go about updating the method below: (What is the ParentTrail And is this not do able with the parent property on the content Items)

private static void UpdateParentTrail(Definitions.BlogItem item)
            N2.Collections.ItemList parents = new N2.Collections.ItemList();
            for (N2.ContentItem parentItem = item.Parent; parentItem != null; parentItem = parentItem.Parent)

            for (int i = item.ParentTrail.Count - 1; i >= 0; i--)
                if (!parents.Contains((N2.ContentItem)item.ParentTrail[i]))
            foreach (N2.ContentItem parentItem in parents)
                if (!item.ParentTrail.Contains(parentItem))

Next there is the BaseBlogPostContainer. It has a method called GetPost

public virtual N2.Collections.ItemList GetPosts(int startIndex, int maxCount)
            return new N2.Collections.ItemList(
                    .SetSortExpression("Published DESC")

Form what i can see this is just a list of  blog post.   Will something like this work . (Yes i know this is in VB that's what I know )
        Public Overridable Function GetPosts(ByVal startIndex As Integer, ByVal maxCount As Integer) As N2.Collections.ItemList

            Dim mParent As ContentItem
            Dim mlist As ItemList = New ItemList
            mParent = N2.Find.Items.Where.ID.Eq(startIndex).Select.FirstOrDefault()
            mlist = mParent.Children
            mlist.Sort("Published DESC")
            Return mlist

        End Function

I will be adding this to the addons page as soon as I get a working Copy.

Thanks for all the help,

Jan 16, 2009 at 10:16 AM
Hello Elizabeth, once i've tried to modernize n2blog and have even written about it here, but it was long time ago, also, i wasn't so much interested in a blogging functionality, but rather understanding of how n2 works.

By the way, what do you think about running BlogEngine.Net on top of N2? Here is the stuff: [ ]. (Yes, it's a shameless advertisement, but i'd happy if someone interested could take over that code :-)