Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

InlineRSS

Summary: Allows insertion of an RSS feed's contents into a PmWiki page.
Version: 1.0
Prerequisites: None
Status: DRAFT
Maintainer: zkarj
Categories: Includes, RSS

Questions answered by this recipe

How can I display an RSS feed in a PmWiki page?

Description

These instructions are still in draft!

Overview

This recipe is based (heavily) on Cal Demaine's WordPress plugin "inlineRSS" available from his website.

The RSS feed is fetched (from its URL or a cache) and transformed to PmWiki markup using an XSLT transformation. A default transformation is supplied.

Installation

Download the PMinlineRSS.zipΔ file and extract locally. It contains the following files

  + PMinlineRSS
  |-- PMinlineRSS.php
  |-- PMinlineRSS.xslt

Copy the directory into your cookbook directory on your server and then add the following to your localization file

include_once('cookbook/PMinlineRSS/PMinlineRSS.php');

Now you're ready to go.

Use

The full markup is

(:inlineRSS feed="http://feeds.feedburner.com/ilounge" cachename=ilounge cachetime=15 altXSLT="myxslt.xslt":)

The parameters are:

feed=""
The URL of the RSS feed. Best left quoted I think, though not sure exactly why.

cachename=
An optional parameter. If specified then the feed will be written to a cache file the first time it is read and thereafter the feed contents will be read from this cache unless it is older than the time specified on the cachetime= parameter. Ensure that this is set to a unique value if you include multiple feeds on your site. See Notes below for detail on how the caching is done.

cachetime=
An optional parameter. This defines the number of minutes old the cache must be before the feed will be re-fetched from the URL. If you do not specify cachetime= but do specify cachename= then the default is 30 minutes. Note that it is possible to include the same feed in two different places with different time-outs and everything will work fine.

altXSLT=""
An optional parameter which specifies the name of the XSLT file used to transform the feed to PmWiki markup. If not specified, the default XSLT file (PMinlineRSS.xslt) is used. All XSLT files must reside in the cookbook/PMinlineRSS/ directory. The default file shows the channel name as a heading (level 3) and this is a link to the web site that provides the feed. All items are then listed in a bulleted list, each item title being a link to the item.

Notes

Customizing

You may edit a few lines in PMinlineRSS.php if you wish, though this would only seem necessary if there are naming conflicts with the cache files. The lines are commented and thus self explanatory, at the top of the file:

  $cookbookpath = 'cookbook/PMinlineRSS/'; // Path to directory containing XSLT files
  $cachepath = 'pub/';                     // Path to directory for cache files
  $fileprefix = 'cache_';                  // What cache file names get prefixed with
  $xsltfile = 'PMinlineRSS.xslt';          // The default xslt file

Note that cache file names are built from $cachepath + $fileprefix + cachename + ".xml"

You can of course replace the XSLT file (or better still, add your own and use altXSLT to invoke it) but I recommend you start from the default file as there are some big gotchas with RSS versus RDF feeds which took me a while to master!

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

Comments

Hi, work great! but is there a way to choose the number of post you want to show? touann - 12/07/2007

When I attempt to create a page with an {:inlineRSS:) markup, I get a white screen, blank except for the words "No valid XSLT processor found." I installed everything exactly as it was written here and have tried pointing to several different feeds to see if any worked. Mike - 8/30/2007

I am pretty sure this requires PHP5 with the XSLT functionality enabled. I am getting the same error as above. Scott - 2/18/08

See Also

Contributors

zkarj

Edit - History - Print - Recent Changes - Search
Page last modified on February 18, 2008, at 03:26 PM