RSS Feeds Reader Plugin for jQuery
This plugin will read RSS feeds from any website URL using the Google Feeds API. It produces structured HTML with in-built CSS classes for styling. Simple and easy to use.
Features
- Supports Atom 1.0, RSS 2.0, RSS 1.0 & RSS 0.9x.
- For jQuery versions 1.4, 1.5, 1.6 and 1.7.
- Specify the number of feeds to return.
- Choose to include header, date and description.
- Specify the title HTML tag.
- Choose to use either a brief or full description (when available).
- Produces all HTML code and style classes.
- Customised error message.
- Support for SSL requests.
- Specify the target for feed links.
- Supports media attachments using the enclosure tag.
- User callback function.
- Sort by title or date.
- Start at specified feed item.
- Redirect feed links.
- Format feed dates. * New *
Demonstrations
- Basic RSS feed example
- Animating RSS feeds with zFramework
- RSS feed with media attachments
- Multiple RSS feeds with ticker animation
- Selecting RSS feeds from a menu
- RSS feed with images and ticker animation
- RSS feed with custom fonts using Cufon
- Displaying RSS feeds with jQuery Mobile
- How to sort feeds by title and date
- Starting a feed at a specific item
- Redirecting RSS feed links to another page
- RSS feed content link example
- How to limit feed title lengths
- Formatting RSS feed dates>
- Paging though RSS feeds using pagination * New *
Download
Latest version 1.2.0 - Click here to download
Getting Started
First include the jQuery and zRSSFeed libraries.
<script src="jquery.zrssfeed.min.js" type="text/javascript"></script>
Add a DIV tag where you wish the feed to display and give it an ID. There is no need to specify a class, this will be added.
<div id="test"></div>
Now add the script to call the zRSSFeed plugin with the RSS URL and any options. Our example gets 5 feeds from the Reuters site.
<script type="text/javascript">
$(document).ready(function () {
$('#test').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews', {
limit: 5
});
});
</script>
Parameters
| Parameter | Required | Description |
|---|---|---|
| url | Yes | The complete URL to the RSS feed ie http://feeds.reuters.com/reuters/oddlyEnoughNews |
| options | No | Optional settings for the plug-in (see below). |
| fn | No | Optional user callback function which is called after feeds are successfully loaded. |
Plug-in Options
| Parameter | Default | Description |
|---|---|---|
| limit | 10 | The number of feeds to return (maximum 100). |
| offset | 1 | The feed item number to start at. |
| header | true | If true, includes the header section containing the feed name and link. |
| titletag | h4 | Specifies the HTML tag for the feed title. |
| date | true | If true, includes the feed date section. |
| dateformat | datetime | The format of feed dates: 'datetime' - full date and time, 'date' - date only, 'time' - time only, 'timeline' - lasped time or a format mask ('dd/MM/yyyy hh:mm:ss'). |
| content | true | If true, includes the feed description. |
| snippet | true | If true, shows a short description for the feed item, otherwise the full content is displayed. |
| media | true | If true, displays media items when available. |
| showerror | true | If true, and an error is returned from the Google Feeds API, the error message is shown. |
| errormsg | - | Replaces the default friendly message when an error occurs. |
| key | null | Optionally use a Google API key. |
| ssl | false | Support for SSL. Set to True when using secure pages. |
| linktarget | _self | Specifies the target for all feed links ('_blank', '_self', '_top', framename). |
| linkredirect | - | Specifies a page to redirect the feed links to. The original link is contained in the URL parameter named 'link'. |
| linkcontent | false | If true, displays the content of the feed item as a link. |
| sort | - | Sorts the feed items by either 'title' or 'date'. Leave empty for no sorting. |
| sortasc | true | Specifies the sort direction, either ascending (true) or descending (false). |
| historical | false | If true, returns any additional historical records that may exist. |
HTML and CSS Styling
The plugin returns the following HTML and styling classes. Note: The 'rssFeed' class is automatically added to the users element.
Successful return
<div id="test" class="rssFeed">
<div class="rssHeader"><
<a>... (heading) ...</a>
</div>
<div class="rssBody"></div>
<ul>
<li class="rssRow odd">
<h4><a>... (title) ...</a></h4>
<div>... (date) ...</div>
<p>... (description) ...</p>
<div class="rssMedia">
<div>Media files</div>
<ul>
<li><a>... (media link) ...</a></li>
</ul>
</div>
</li>
<li class="rssRow even">...</li>
...
</ul>
</div>
</div>
The 'odd' and 'even' classes may be used to style alternate lines.
Failed return
<div id="test" class="rssFeed">
<div class="rssError">
<p>... (error message) ...</p>
</div>
</div>
License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.