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

Forums / Developing with Sitefinity / Last comment list

Last comment list

4 posts, 0 answered
  1. Gerardo
    Gerardo avatar
    15 posts
    Registered:
    20 Sep 2012
    16 Sep 2008
    Link to this post
    Is possible put a list with last comments of a blog?
    Like blogspirit or wordpress.

    Thank
  2. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    17 Sep 2008
    Link to this post
    Hi Gerardo,

    Thanks for contacting us.

    This requested functionality can be achieved by using the IComment Interface of the Blogs Module. You would need to create an instance of the BlogManager class  and sort the comments using the GetContent method. The section about "Get the list of all generic content objects ordered by passed sorting expression" should help you achieve the required functionality. This video on using our API should also assist you.

    I hope that I have given you the necessary information to achieve your desired functionality. Feel free to contact us if you need further assistance.

    Sincerely yours,
    Joe
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Gerardo
    Gerardo avatar
    15 posts
    Registered:
    20 Sep 2012
    17 Sep 2008
    Link to this post
    Thank, but this is a complex solution..

    Not work the link:
    http://www.sitefinity.com/help/developer-manual/content-items-get.html#How_to_Find_Read_Comments


    regards
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    20 Sep 2008
    Link to this post
    Hi Gerardo,

    Joe has suggested you the correct approach, but seems like he accidentally passed the wrong link. To read more about comments in general, you can go to this page:
    http://www.sitefinity.com/help/developer-manual/comments-overview.html

    To find out more about retrieving comments, you can visit this page:
    http://www.sitefinity.com/help/developer-manual/comments-get.html

    This example shows exactly how to get 10 latest comments:
    // create new instance of ContentManager  
    Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();  
    IList listOfComments = contentManager.GetComments("DateCreated DESC", 0, 10);  
    if (listOfComments.Count > 0)  
    {  
       foreach (Telerik.Cms.Engine.IComment commentItem in listOfComments)  
           Response.Write(commentItem.Text + "<br />");  
    }  

    Once you get the data in the listOfComments list, you can bind it to a repeater, grid, listview...

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    Sincerely yours,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered