RssFeedDisplay
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 Main/RecentChanges:) [1], 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.
Try to include an external url with this markup : IncludeUrl
Download rssdisplay.zipΔ. This archive already constains MagpieRSS.
For PHP 7.2 please get rssdisplay-php72.zipΔ instead.
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
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:
$FarmD
/cache
$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
2016-01-14 | New release compatible with PHP-5.5 (Anomen) | |
2011-11-30 | New rewritten version (Anomen) | |
2005-10-30 | 1.32 | Added 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-18 | 1.31 | Looks like the htmlspecialchars stuff was not a good thing |
2005-10-11 | 1.30 | replaced ',' 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-16 | 1.14 | Magpie 0.61 basic atom support |
2004-01-12 | 1.4 | Using new Keep function Added <ul> to meet xhtml validation |
2004-01-12 | 1.2 | Added more ways to display the feed. |
2004-01-10 | 1.0 | Initial version. |
- archived documentation
- RssFeedDisplay-Archive
- git repository
- https://github.com/anomen-s/pmwiki-recipes/tree/master/RssFeedDisplay
See also
- SimplePieDisplay - alternative RSS recipe using more up-to-date feed reader
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.