More in this section

Forums / Developing with Sitefinity / Modules -> News -> obosolete??!?!?

Modules -> News -> obosolete??!?!?

5 posts, 0 answered
  1. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    17 Jun 2009
    Link to this post
    Hello there,
    we were using two controls which are obsolete and cannot be used in Sitefinity 3.6 -> NewsList and SingleNews. In order to upgrade our site to 3.6 we have to remake those controls! I've a few questions:

    1. Is there a way to retrieve a single news item and get it's title?
    2. Is the Article class somehow a news item?
    Guid guid = new Guid(HttpContext.Current.Session["newsItem"].ToString()); 
    IContent singleNews = nm.Content.GetContent(guid); 
    How can I change this IContent object to an Article one, so I can use it's properties  such as Summary, Title, etc.

    3. Why do you keep the News module, since you have removed its main controls like NewsList and SingleNews!?!??!?!

    Thx
  2. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    17 Jun 2009
    Link to this post
    oh and when I'm in News in Sitefinity and I try to edit something I get:

     The method or operation is not implemented.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NotImplementedException: The method or operation is not implemented.
  3. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Jun 2009
    Link to this post
    Hi Angel,

    Thank you for contacting Telerik Support.

    The NewsList and SingleNews controls have been obsolete since Sitefinity version 3.2 SP1. However their functionality has not been lost. The control that takes care for that is NewsView and provides functionality both for displaying news in the form of a list and as a single item.

    In order to be able to get and set properties such as summary and title for news items you have to use the NewsManager class, which is part of the Telerik.News namespace. Here is an example for creating a news item:

     // create new instance of NewsManager 
    Telerik.News.NewsManager newsManager = new Telerik.News.NewsManager("News"); 
    // create a news content item by calling the CreateContent method of the 
    // ContentManager class through the NewsManager class 
    Telerik.Cms.Engine.IContent newsContent = newsManager.Content.CreateContent("text/html"); 
    // save the Content property value, and the Title meta key 
    newsContent.Content = "My first News Item"
    newsContent.SetMetaData("Title""News 1"); 
    //save the Content item through the NewsManager 
    newsManager.Content.SaveContent(newsContent); 
    Response.Write(newsContent.Content + "<br />");  
    From the code you can see that the News module has a metakey for the Title, when we are using the SetMetaData method of the newsContent. You can also use the following metakeys for the news module: Summary, Author, Source, Publication_Date, Expiration_Date, Thumbnail, Category.

    For more information on the News module, and the News API in version 3.6, please read:
    News Module Overview
    News API Overview
    News API Walkthrough

    I hope that this information will answer your questions. Feel free to contact us if you have any other problems.

    Kind regards,
    Rado
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    18 Jun 2009
    Link to this post
    Hi Rado,
    that information rally helped me.

    I'm having one more trouble though:

    My news page is:
    http://localhost:8080/en/News.aspx
    and my news items urls are something like this:
    http://localhost:8080/en/News/NewsItem/09-01-19/something-interesting.aspx

    Now, I have a page created in SF under News.aspx, called NewsItem.aspx, but when I try to load the news item, it says The resource cannot be found. I guess it tries to load page something-interesting.aspx in ~/en/News/NewsItem/09-01-19/

    I guess the rewriting is lost somewhere between the versions of SF (since NewsList and SingeNews were removed). Is there a way to do my own rewriting without using HttpModules? Because the it would go trough it every time some page in the site is loaded?

    Thanks again,
    Angel
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Jun 2009
    Link to this post
    Hello Angel,

    Once you have put a NewsView control on a specific page (in your case ~/News.aspx) the control automatically handles requests to view single news items. However you can set it up to use your custom URL for the the single news item and for the news list items.

    In your case:
    1) Go to the page where you have your news list displayed on (~/News.aspx page) click edit of your NewsView control, select Advanced, go to the Explicit Links section and select the appropriate URL for the single news item in SingleItemUrl (for example ~/News/NewsItem.aspx). Click I'm Done and publish the page.
    2) Go to the page where you display single news items (~/News/NewsItem.aspx) and perform the same routine, except this time you will set the property ItemListUrl to be ~/News.aspx.

    Furthermore if you wish your URLs to be rewritten in a specific way. Gabe Sumner has a very interesting webinar on URL rewriting. You can watch the webinar here. In it, it's explained how to rewrite URLs using as an example the Blogs Module controls but the principle is basically the same.

    Sincerely yours,
    Rado
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
5 posts, 0 answered