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

Forums / Developing with Sitefinity / Add 'Similar News' section to the news.

Add 'Similar News' section to the news.

6 posts, 1 answered
  1. Sachin
    Sachin avatar
    18 posts
    Registered:
    10 Nov 2010
    15 Feb 2012
    Link to this post
    Hi,

    Is there a way to add 'Similar News' section to the detail mode of the news visitor is reading? So if a visitor click on one of the news from the list of all news, he will see the entire news as well as the list of top five most recent news from the same category.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    20 Feb 2012
    Link to this post
    Hello,

    That's a tough one, we do not offer such functionality yet, however thank you very much for pointing out the need for it. We have supplied customers with samples on how to achieve similar functionality for related videos, so I believe it is possible to help you achieve the desired functionality. Can you please fill us in with some more details on the desired criteria the related products should be picked? If it's the latest news from the same category you can modify the default template used for News DetailsView and add a RadListView control for example, which will be populated with the latest news from the same category as the item currently displayed by the DetailsView.

    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Sachin
    Sachin avatar
    18 posts
    Registered:
    10 Nov 2010
    22 Feb 2012
    Link to this post
    The similar/related news can be the news that are listed under the same category, sorted by time and then it can display latest 3 or 5 of them. How would you populate the RadList with the news from same category of the news they are on?
  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    27 Feb 2012
    Link to this post
    Hello,

    Please find attached a sample control we've prepared for you which achieves the desired functionality. Please let us know if you need any additional information.

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Sachin
    Sachin avatar
    18 posts
    Registered:
    10 Nov 2010
    05 Mar 2012
    Link to this post
    Hi Boyan,
    It looks like it is for Sitefinity 4.x. I am working with 3.7. I get error that it cannot find some of the methods like GetUrlParameterString or GetItemFromUrl etc. Can you specify the equivalent methods for them which will work with 3.7?
  6. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    02 Dec 2016
    08 Mar 2012
    Link to this post
    Hi,

    Please excuse me for the inconvenience, it looks like I've indeed missed that the specified project is 3.x where the approach should be the same but with slightly different implementation:
    protected void Page_Load(object sender, EventArgs e)
       {
           var newsManager = new ContentManager("News");
           if (Context.Items.Contains(newsManager.Provider.ContentItemKey))
           {
               //get the current itme form the URL
               var itemId = ((IUrlRewriteData)Context.Items[newsManager.Provider.ContentItemKey]).Data as Guid;
               var currentItem = newsManager.GetContent(itemId);
               var category = currentItem.GetMetaData("Category").ToString().ToLower();
                
               // get all news content items
               IList listOfNewsItems = newsManager.GetContent();
               var filteredList = new IList<IContent>();
               if (listOfNewsItems.Count > 0)
               {
                   //get all News with the same category
                   foreach (Telerik.Cms.Engine.IContent newsItem in listOfNewsItems)
                   {
                       var newsCat = newsItem.GetMetaData("Category") as string;
                       if (newsCat.ToLower() == category)
                       {
                           filteredList.Add(newsItem);
                       }
                   }
               }
     
               //now you can bind a RadListView or Repeater to the filteredList collection of News
           }
     
       }
    You can map an external template for ListPageDetails.ascx for News and also add a suitable DataBound control to the template which you're going to populate with the filtered news.

    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
Register for webinar
6 posts, 1 answered