XML feeds: Difference between revisions From Online Manual

Jump to: navigation, search
(Needs to be converted to wiki formatting and some changes made)
 
mNo edit summary
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
One of the best features in SMF is its news feeds. However, many people aren't aware of how many options there are, or that this is even available. So, here's a list of available options and what they do...
{{TOCright}}A feature of SMF is its news feeds. However, many people are unaware of how many options there are, or that this is even available. Below is a list of available options and what they do:


First, make sure you've enabled the feeds:
==Enable the Feeds==
 
This should be enabled by default, but you can check by going to ''Admin -> News and Newsletters -> Settings'' and ensuring that there is a tick in box next to "Enable XML/RSS News".
Admin -> News and Newsletters -> Settings
The "Maximum post length" value determines how many characters of a post are output in the feeds. The default value (255) should be sufficient in most cases.
Check the box next to "Enable XML/RSS News".
The "Maximum post length" value determines how many characters of a post are output in the feeds. The default value (255) is fine for now
 
 
Now, on to the fun stuff.


==URL options for showing XML content==
All of the XML content is accessed via the ".xml" action...
All of the XML content is accessed via the ".xml" action...
Other formats can be achieved by adding one of the following to the URL:
Other formats can be achieved by adding one of the following to the URL:
;type=atom - [url=http://en.wikipedia.org/wiki/Atom_(standard)]Atom[/url]
*'''type=atom''' - [http://en.wikipedia.org/wiki/Atom_(standard) Atom]
;type=rdf - [url=http://en.wikipedia.org/wiki/Resource_Description_Framework]RDF[/url]
*'''type=rdf''' - [http://en.wikipedia.org/wiki/Resource_Description_Framework RDF]
;type=rss - RSS 0.91
*'''type=rss''' - RSS 0.91
;type=rss2 - RSS 2.0
*'''type=rss2''' - RSS 2.0


The default feed is the 5 most recent posts:
The default feed is the five most recent posts:
http://www.simplemachines.org/community/index.php?action=.xml
http://www.simplemachines.org/community/index.php?action=.xml


There are several "sub-actions" available to this action, specifying exactly what to display:
===Sub-actions===
 
Add sa=<nowiki><sub-action></nowiki> to the URL query string to use these sub-actions.
[b]Recent Posts[/b] (displays the most recent posts that you can see)
====Recent Posts====
"Sub-action": recent
Displays the most recent posts that you can see:
Default: Shows 5 most recent posts
*'''Sub-action''': recent
Available options:
*'''Default''': shows the five most recent posts
limit=x - display the "x" most recent posts (if number is less than 5, it will display 5. If number is larger than 255, it will display 255).
*'''Available options''':
board=y - display only the recent posts from board "y"
**'''limit=x''' - display the "x" most recent posts (if the number is less than five, it will display five. If number is larger than 255, it will display 255).
boards=x,y,z - display only the recent posts from the specified boards
**'''board=y''' - display only the recent posts from board "y".
c=x or c=x,y,z - display only the recent posts from boards in the specified category/categories
**'''boards=x,y,z''' - display only the recent posts from the specified boards.
Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=recent;board=72;limit=10
**'''c=x or c=x,y,z''' - display only the recent posts from boards in the specified category/categories.
 
*'''Example''': <nowiki>http://www.simplemachines.org/community/index.php?action=.xml;sa=recent;board=72;limit=10</nowiki>.
[b]News[/b] (displays the first post from the most recent topics that you can see)
"Sub-action": news
Available options:
limit=x - display only "x" items
board=y - display only news topics from board "y"
boards=x,y,z - display only news topics from the specified boards
c=x or c=x,y,z - display only news topics from boards in the specified category/categories
Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=news;board=72;limit=10
 
[b]Members[/b] (displays most recent members):
"Sub-action": members
Available options:
limit=x - display only the "x" most recent members
Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=members;limit=10
 
[b]Profile[/b] (displays the "profile summary" data in a nice XML feed for the specified user)
"Sub-action": profile
Required option:
u=x - display the profile info for user whose ID is "x"
Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=profile;u=150
 
Now - you're probably wondering what you can do with this. Quite a bit actually.


You can syndicate this stuff by giving people these URLs to use on their sites (they will need to have their own RSS parser to deal with it though - CaRP is a good free one (requires PHP)). You can also use PHP's XML Parser Functions to format the output the way you want it (although you can also do this using SSI.php). There are also several free sites that will parse the feeds for you, including www.rss2javascript.com and www.feedburner.com.
====News====
Displays the first post from the most recent topics that you can see:
*'''Sub-action''': news
*'''Available options''':
**'''limit=x''' - display only "x" items.
**'''board=y''' - display only news topics from board "y".
**'''boards=x,y,z''' - display only news topics from the specified boards.
**'''c=x or c=x,y,z''' - display only news topics from boards in the specified category/categories.
*'''Example''': <nowiki>http://www.simplemachines.org/index.php?action=.xml;sa=news;board=1;limit=10</nowiki>.


You can also subscribe to these feeds through an XML reader, Firefox, Thunderbird or any other software that supports XML or RSS feeds (note - Outlook and Outlook Express do not support this...) - you will need to have either "type=rss" or "type=rss2" somewhere in the URL for it to work. If you would like to know how to set this up in Firefox or Thunderbird, let me know. Enjoy!
====Members====
Displays most recent members:
*'''Sub-action''': members
*'''Available options''':
**'''limit=x''' - display only the "x" most recent members.
*'''Example''': <nowiki>http://www.simplemachines.org/community/index.php?action=.xml;sa=members;limit=10</nowiki>.


EDIT: Updated post to reflect options available in 1.1.
====Profile====
EDIT again: Fixed typo (";type=rss - RSS 2.0" -> ";type=rss2 - RSS 2.0" - thanks to [url=http://www.simplemachines.org/community/index.php?action=profile;u=48405]Sarge[/url] for pointing that out)
Displays the "profile summary" data in a nice XML feed for the specified user:
*'''Sub-action''': profile
*'''Required option''':
**'''u=x''' - display the profile info for user whose ID is "x".
*'''Example''': <nowiki>http://www.simplemachines.org/community/index.php?action=.xml;sa=profile;u=150</nowiki>.


Need to add EDIT: http://www.simplemachines.org/community/index.php?topic=25009.msg3087967#msg3087967
[[category:FAQ]]

Latest revision as of 10:18, 3 June 2016

A feature of SMF is its news feeds. However, many people are unaware of how many options there are, or that this is even available. Below is a list of available options and what they do:

Enable the Feeds

This should be enabled by default, but you can check by going to Admin -> News and Newsletters -> Settings and ensuring that there is a tick in box next to "Enable XML/RSS News". The "Maximum post length" value determines how many characters of a post are output in the feeds. The default value (255) should be sufficient in most cases.

URL options for showing XML content

All of the XML content is accessed via the ".xml" action... Other formats can be achieved by adding one of the following to the URL:

  • type=atom - Atom
  • type=rdf - RDF
  • type=rss - RSS 0.91
  • type=rss2 - RSS 2.0

The default feed is the five most recent posts: http://www.simplemachines.org/community/index.php?action=.xml

Sub-actions

Add sa=<sub-action> to the URL query string to use these sub-actions.

Recent Posts

Displays the most recent posts that you can see:

  • Sub-action: recent
  • Default: shows the five most recent posts
  • Available options:
    • limit=x - display the "x" most recent posts (if the number is less than five, it will display five. If number is larger than 255, it will display 255).
    • board=y - display only the recent posts from board "y".
    • boards=x,y,z - display only the recent posts from the specified boards.
    • c=x or c=x,y,z - display only the recent posts from boards in the specified category/categories.
  • Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=recent;board=72;limit=10.

News

Displays the first post from the most recent topics that you can see:

  • Sub-action: news
  • Available options:
    • limit=x - display only "x" items.
    • board=y - display only news topics from board "y".
    • boards=x,y,z - display only news topics from the specified boards.
    • c=x or c=x,y,z - display only news topics from boards in the specified category/categories.
  • Example: http://www.simplemachines.org/index.php?action=.xml;sa=news;board=1;limit=10.

Members

Displays most recent members:

  • Sub-action: members
  • Available options:
    • limit=x - display only the "x" most recent members.
  • Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=members;limit=10.

Profile

Displays the "profile summary" data in a nice XML feed for the specified user:

  • Sub-action: profile
  • Required option:
    • u=x - display the profile info for user whose ID is "x".
  • Example: http://www.simplemachines.org/community/index.php?action=.xml;sa=profile;u=150.


Advertisement: