Latest Register Log In

+ Advanced Search

RSS Feeds

RSS Feeds
By
07/16/04 (Edited 08/06/18)

This article is about generating an RSS feed from your WSN content. If you're looking to submit an existing RSS feed's content to become WSN content, see XML Submissions and if you just want to display a feed's content in a template see Template RSS Parser.

If you're not familiar with what RSS is about, see http://www.webreference.com/authoring/languages/xml/rss/intro/ for a quick intro (you don't need to bother reading about the syntax, as WSN handles that for you).

When the RSS feeds switch is enabled at Admin -> Settings -> Switches, WSN will autoinclude <link rel="alternate" type="application/rss+xml" title="{SITETITLE}" href="{RSSURL}" > in the head section of your pages to inform web browsers that the page has a feed available. If you would also like to add a link on your page, you can use <a href="{RSSURL}">RSS Feed</a> to the wrapper template at Admin -> Themes -> Manage Templates -> Wrapper. Note that {RSSURL} will usually we a full-site feed, but when you're viewing a particular category it'll change to a feed filtered for the particular category instead.

You can also construct your own feed urls. WSN makes RSS feeds available through the file rssfeed.php. The feed contains a url, title and description. These feeds work basically like toplists. Just as for toplists, you can specify the ordering and type and number of items listed by tacking the info onto the end of the URL. For example:
rssfeed.php?type=links&number=5&field=time&ascdesc=descending


This URL would give a feed of 5 articles, ordered by newest first. If you wanted a feed of 10 comments, you could use
rssfeed.php?type=comments&number=10&field=time&ascdesc=descending


To do only regular articles, you'd use
rssfeed.php?type=links&number=5&field=time&ascdesc=descending&thecondition=type='regular'


To do a feed for a specific category, you would use rssfeed.php?thecondition=catid=10 for category #10. If on the 'show articles in category' template simply use the {CATID} template variable to make it show for every category (catid={CATID}).

Note that only words should be quoted in the condition part of a url, never numbers.

Note that you can do a random order with field=rand()

Note that the RSS stylesheet is at rss.css.

Applicable to WSN Links only: if you wish to have the feed link to the link details page instead of to the destination url, pass &usedetails=1 in the URL.

If you want static versions of these feeds for lower server load, you can use the 'static file generation' area of your admin panel to have a static version of the specific URL you desire saved.

Note that if you're looking to use a complex filtering condition you need to use URL-legal characters, meaning spaces become %20, such as
rssfeed.php?thecondition=catid=6%20OR%20parentids%20LIKE%20'%|6|%'


Types of feeds you can specify in the url:
type=links - articles
type=categories - categories
type=comments - comments
type=cal - calendar events

You can edit the RSS feed content using the RSS feed template, and can use a custom template over it as with any other template by affixing &custom=yes&TID=templatename to the URL.

Location-Based Feeds

If your directory has addresses of physical locations, you can create a feed of articles near a specified location. This example will show the newest articles within 20 miles of the viewer (as calculated by IP address if you have the geolocation database installed):
rssfeed.php?zipmiles=20&zippostal=visitorlocation

This alternate example shows articles within 15 miles of the zipcode 95682 (Shingle Springs, California, USA):
rssfeed.php?zipmiles=15&zippostal=95682

Adjust the URLs as desired.

Speed

In order to save server load and increase speed, you may want to make static copies of key feeds. You can use Admin -> Miscellaneous -> Static File Generation for that.




Description How to let visitors with an RSS reader view info from your site, or how to syndicate content with RSS-enabled sites.
Rating
Views 4650 views. Averaging 1 view per day.