Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

RssFeedDisplay

Summary: How to add an RSS feed to a page
Version: 2011-11-30
Prerequisites:
Status:
Maintainer: Anomen
Users: (View? / Edit)
Categories: RSS

Questions answered by this recipe

Adding an RSS feed to your page.

Description

Use the rss feed from another site, or your own, to be displayed on your wiki. For example, include the most recent changes. (That could also be done with a [include:RecentChanges]], but when using a parser you can easily change the look, or display only the top 10 changes.) This is also a good way to display images dynamically from Flickr.

This recipe uses RSS parser Magpie.

Installation

Your host must allow outgoing http requests.

How do I check if my host allows outgoing http requests?

Try to include an external url with this markup : IncludeUrl

Is this a setting I need to change in the Apache config file(s)?
Try it? ( I will try to make a test script soon)

Download rssdisplay.zipΔ. This archive already constains MagpieRSS.

Extract the archive into your PmWiki folder.

Add following line to local/config.php:

 include_once("$FarmD/local/rssdisplay.php");

caching

Create a cache-directory $FarmD/cache to avoid having the rss feed fetched a zillion times a day. Ensure the directory is writable for the webserver (chmod 777). Add into local/config.php:

 $MagpieEnableCache = true;

Security

Please note that this recipe is inherently insecure. Never allow untrusted users use RSS markup, they could include feed with malicious content. Also be sure to add only trustworthy feeds.

Usage

 (:RSS http://example.com/rss.xml [long|short] [noheader] [number_of_items] :)

Parameters

how
display only titles (short) or also descriptions (long) of feed items
number_of_items
number of items to display, -1 means all items
header
noheader will hide header of feeds

This will display the items in a default display mode with a default maximum of items:

(:RSS http://example.com/rss.xml :)

To display a short format and a max of 5 items use:

(:RSS http://example.com/rss.xml short 5 :)

Configuration

List of configuration variables with their respective default values:

$MagpieDefaultItems
default number of displayed items of feed (default 30)
$MagpieDefaultFormat
default format of displayed items of feed (default 'long')
$MagpieCacheDir
cache directory ("$FarmD/cache")
$MagpieCacheAge
cache item timeout (2 hours)
$MagpieProxy
proxy server, use syntax hostname:port
$MagpieFetchTimeout
timeout for fetching RSS feeds (15)
$MagpieGzip
use gzip compression for fetching feeds
$MagpieDir
directory where Magpie is installed ("$FarmD/cookbook/magpie")
$MagpieOutputEncoding
encoding of content produced by feed reeder (defaults to $Charset)
$MagpieDebug
output error messages from Magpie.

Encoding

To properly display non-ASCII characters you need to define proper encoding of PmWiki pages. The best way is to swich PmWiki to Unicode by inserting this line at the beginning of local/config.php:

  include_once("scripts/xlpage-utf-8.php");

Be warned that it breaks special characters you already have in existing pages.

See PmWiki:Internationalizations for details.

Change log / Release notes

2011-11-30 New rewritten version (Anomen)
2005-10-301.32Added html_entity_decode for the rss-url (thanks to JohnCooley?)
  Added some utf8 translation to html entities
  Cleaned the Comments & Bugs list below a bit
2005-10-181.31Looks like the htmlspecialchars stuff was not a good thing
2005-10-111.30replaced ',' with space as seperator;setting error_reporting to zero;cleaned up html output;added conversion htmlspecialchars
2004-12-13 Pmwiki 2.0 beta
2004-05-161.14Magpie 0.61 basic atom support
2004-01-121.4Using new Keep function
Added <ul> to meet xhtml validation
2004-01-121.2Added more ways to display the feed.
2004-01-101.0Initial version.
archived documentation
RssFeedDisplay-Archive
git repository
http://repo.or.cz/w/anomen-overlay.git/tree/HEAD:/www-apps/pmwiki/cookbook/RssFeedDisplay

See also

Links

Contributors

Comments

See discussion at RssFeedDisplay-Talk.

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on December 05, 2011, at 08:36 AM