+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Blog comment count and blog sorting

Blog comment count and blog sorting

2 posts, 0 answered
  1. Iain
    Iain avatar
    26 posts
    Registered:
    29 Dec 2010
    13 Jan 2011
    Link to this post
    I'm looking for a solution to

    A) display the number of blog comments within the ContentViewItemList control for each blog entry.

    and

    B) gather the top 10 blog entries based on the number of blog comments - i.e most popular blogs.

    I've just got the hang of control templates and its all very easy to implement but I'm guessing I'll need to get into the coding side of things.


    Thank you in advance


    Iain
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Jan 2011
    Link to this post
    Hi Iain,

    1. You have to get the content item ID from the Query String. Then you have access to the IContent object which has a property Comments that you can use.

    if (Context.Items.Contains(Manager.Provider.ContentItemKey))
    itemId = (Guid)((IUrlRewriteData)Context.Items[Manager.Provider.ContentItemKey]).Data;

    2. Each Blog post is an IContent item that has Comments property, so you can easily  calculate and compare the count of the post and sort the top 10 posts. Please take a look at Content API

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered