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

Forums / Developing with Sitefinity / Image and Documents RSS feed

Image and Documents RSS feed

4 posts, 1 answered
  1. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    28 Jun 2009
    Link to this post
    Hi, I require a RSS feed of the images and documents module. I have read the documentation and the blogs on the topic but I am still not clear, plus the blog seems to be for older versions of SiteFinity.

    The main things I am not clear on are:
    How to register the new RSS with the RSS service.
    Is there any way of controlling the output xml of the feed as I need to feed this into a thrid party application that may have special requirements.

    I have created a class library based on SelAroms blogs, and I am guessing that Everything is good (although I havn't got it to run). I would be happy to send in this library if that helps, but I can not work out how to register it. I tried adding it to the rss section of the web.config, but this caused the service to fail to initalise (non descriptive error).

    Thanks


  2. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    30 Jun 2009
    Link to this post
    Hello Nigel,

    I will first explain how the whole thing works, and then I will answer to your questions.

    Since you have already read the documentation, I will not discuss the different interfaces in great detail, I will simply point out the important thing. I will also give you examples with the News module.

    First of all, you probably have noticed that in order to implement rss, you have to implement IRssProviderModule. It has only one method - GetRssProviders. It returns a list of rss providers for your module. Therefore, to provide RSS for an existing module, you have to inherit it and implement IRssProviderModule. Here is an example:
    /// <summary> 
    /// Gets information about the Rss providers 
    /// </summary> 
    /// <returns>array with the information on the Rss providers</returns> 
    public RssProviderInfo[] GetRssProviders() 
        return new RssProviderInfo[] {  
                new RssProviderInfo(NewsModule.ModuleName + " Rss Provider"
                typeof(Telerik.News.Rss.RssChannelProvider).FullName + ", " + this.GetType().Assembly.FullName, 
                new Dictionary<stringstring>(), 
                typeof(RssSettingsControl).FullName + ", " + this.GetType().Assembly.FullName, 
                typeof(RssViewControl).FullName + ", " + this.GetType().Assembly.FullName) 
        }; 

    With your RssSettings control, which will edit the settings specific to your Rss feed channel provider, you will want to implement IRssSettingsControl and, probably, SimpleControl (ControlsConfig, Container, etc...).  The IRssSettingsControl interface has only two members: for initializaing the control with some settings (i.e. setting control references with initial values), and for saving the settings once you are done.
    These are very straight-forward, and do not differ in implementing any other control, except that you don't use the control state, but the provided settings dictionary.

    For the view control you will implement IRssViewControl, and probably want to inherit SimpleControl as well. This control's purpose is solely to view the settings of you rss feed channel. Therefore, the IRssViewControl interface contains only one method - for giving your control's control references initial values.

    What actually makes the RSS feed work is the IRssProvider implementation. Since you want to do it for a Generic-Content-based module, you will want to inherit from Telerik.Cms.Engine.RssChannelProvider. It provides caching. Other than the cosmetic Name and Description properties, you will notice the familiar Initialize method in the interface declaration. I will not cover these, as they are straight-forward.

    The interesting part here is the GetRssItems method. Here, you will want to do as this pseudo-code suggests:

    public override IList<RssItem> GetRssItems(System.Collections.Specialized.NameValueCollection query) 
     list of rss items - declare 
     if you do not implement IRssProvider directly, 
        call base.GetRssItems 
     else 
         for every item in your module 
            create a new RssItem 
            set the Link property to a url unique for this rss item 
            set the Comments property to a url for commenting the rss item (usually, same as above) 
            set RssGuid to the id the content item you are making an rss for 
            set the Author property to the user that owns the content item (usually, the Author meta field) 
            set the Title property to the title of the content item (usually, the Title meta field) 
            set the PubDate property to the date when it was published/modified 
            set the Description property to the short description of the rss item. If you want to show the full information, show the full content item text here. If you want to have a summary, you can use the Telerik.Cms.Engine.SummarySettings class, and Telerik.Cms.Web.LinkParser's ResolveLinks static method to "resolve" the dynamic links in your rss feed. 
            add the rss item to the collection that you will return at the end of this method 
     
     if the query has no items, 
        create a new item 
        set its Title property to a message that says something like "No items were added so far" 
       
       
      return your collection of rss items 

    And now to your questions.

    "How to register the new RSS with the RSS service."
    All you need to do is implement IRssProviderModule and register your module as any other module in web.config

    "Is there any way of controlling the output xml of the feed as I need to feed this into a thrid party application that may have special requirements."
    We follow the standard format for Rss. If you want custom xml for Rss, you will have to implemente everything yourself.

    If this explanation is not clear, or you have problems with the implementation, feel free to ask. We would be glad to receive some feedback.

    All the best,
    Dido
    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.
    Answered
  3. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    30 Jun 2009
    Link to this post
    Thanks for the very indepth answer, it explains everything I needed to know. I will investigate this again soon, but I have just implemented an aspx that outputs the rss feed in the yahoo's MediaRSS standard. This has also given me the ability to make use of powerful filtration parameters which I wasn't sure how, or if, I could achieve with the built in feeds.
  4. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    10 Mar 2010
    Link to this post
    Fixed, your instructions above are great thanks.
Register for webinar
4 posts, 1 answered