PmFeed
Description
This recipe uses lastRSS (embedded into PmFeed for you) to display RSS feeds using PmWiki markup.
You can see an example here: http://theendlessnow.com/ten/PmFeed/PmFeed
Another test here: http://ntlug.org/wiki/Main/News
Notes
Place pmfeed.php (this file)Δ into your cookbook directory (e.g. /srv/www/htdocs/pmwiki/cookbook)
Include the cookbook in your local/config.php
include_once("$FarmD/cookbook/pmfeed.php");
Create a cache directory at pub/cache under your your PmWiki base directory. Needs to be writable by the web username.
On a page include the markup with a feed url.
(:pmfeed feed='http://www.digg.com/rss/index.xml':)
or with some variables
(:pmfeed feed='http://www.digg.com/rss/index.xml' showitemdescr='false' max_count=10:)
Variables:
feed= URL to RSS feed file. Defaults to pmwiki.org's Site/AllRecentChanges. cache_time= Time to cache data... be nice to the providers. Defaults to 2000 seconds. Set to 0 to disable. encoding= Override the feed's encoding with this value. imagestyle= A wikistyle to apply to images (see showimages). itemspace= Defaults to 1, means 1 blank line after item. max_count= Number of items to read. Defaults to 0. newwin= Open links to items in a new window. Defaults to true. overrides= Set this to false to prevent URL line GET overrides to these parameters. showfeedxmllink= Defaults to false. Add link by the title to the original RSS feed file. showimages= Defaults to false. Attempt to show images in feed. showitems= Defaults to true. If false, don't show RSS items. showitemdescr= Defaults to true. If false, don't include the description along with the item. showpubdate= Defaults to false. Attempt to show publish date for item. showtables= Defaults to false. Attempt to show tables in feed. showtitle= Defaults to true. If false, don't show the feed title. title= Alternate title instead of using RSS title. unsafe= Defaults to false. If true, allows setting of title and feed from the URL line (_GET).
Release Notes
0.01: Initial release.
0.02: Attempt to interpret some HTML tags as PmWiki equivalents. Enabled for now.
0.03: Renamed banner to title and added several "show" options and added an unsafe option for some flexibility/risk.
0.04: Fixed bug regarding use of newwin=false resulting in bad output (space problem).
0.05: Attempt to handle some character issues (utf8 and other hacks).
0.06: Major updates. Added more options (see below). Much better i18n
support especially when pmwiki is running in utf8 mode. 0.07: Fixes bug with itemspace handler canceling out max_count.
0.08: Added showpubdate option.
20170922: fixed Markup_e, and preg_replace w/e problems -> preg_replace_callback. XES
|
Comments
Title still broken? And HTML in content?
Is this recipe being maintained? The title problem reported below is still happening... e.g. this code:
(:pmfeed feed='http://www.diigo.com/rss/user/Chrisl/cios246' title='Recent Links' :)
gives me a title of 'Recent Links' and then the title of the feed from the feed itself.
Also, is there any simple solution to enabling HTML links in the description of an item to be functional? Again, in the above link there are tags that should be links but are just showing as plain text.
tia -- Chris Lott 1/28/09
Problem with Title
I am having a problem with the Title Option. The Followinlg line output the following Title Dirson"google.dirson.com"
(:pmfeed feed='http://google.dirson.com/rss.php' showitemdescr='false' title='Dirson' max_count=10:)
and this one the following \"Dirson\""google.dirson.com"
(:pmfeed feed='http://google.dirson.com/rss.php' showitemdescr='false' title="Dirson" max_count=10:)
should I write it differently or is it a bug ?
-Edwin Marte, Nov 20 2007
It's a bug. I was attempting to use Alt-Text on a link, but in PmWiki, you can only have Alt-Text on image links. so... right now you'd have to create an image title. I'll try to get a fix out in the next couple of days.
Problem with feedburner?
Can it be used with feedburner? Like this: (:pmfeed feed='http://feeds.feedburner.com/undergoogle' :)
I'm not having any success with this and can't figure it out why.
Undergoogle's supposed rss feed isn't rss or atom... it's junk. Just happens to display well on it's own. Maybe something can make heads or tails of it... it's pretty much just a bunch of CSS and HTML.
Probable causes of "Error: It's not possible to reach RSS file "
Does anyone have any idea what the probable causes of this message are? I can't get this cookbook to embed rss feeds. jd323? March 24, 2009, at 07:50 PM jd323
Unfortunately, it can mean many things. It could be that the format is of the supposed rss is not really rss, but some atom variant. Or it could be that your php and machine do not have any way for php or callouts to wget/curl/lynx to pull the rss url.
I was getting this and managed to fix it by replacing lastRSS 0.9.1 with v2.0.1 from here (not sure how official this is as it isn't on the supposedly official website, but it looks legit). I've updated the download. chrisy? December 03, 2018, at 11:46 PM
Problems with timeout
When the feed fails (e.g. Twitter status displayed on every page) it uses up all the php-cgi possibles locking out the wiki. A way to solve this is to add the timeout as a parameter:
SDVA($PmFeedAltGet, array( '/usr/bin/curl --connect-timeout 5 -k %s', '/usr/bin/wget -T5 -O - %s', '/usr/bin/lynx -connect_timeout=5 -source %s'));
Utopiah February 26, 2011, at 08:02 AM
Problem with PHP function preg_replace for PHP5.5 or newer
Hi Ccox,
I'm using PmFeed a long time - and it's pretty good! Since upgrading to PHP5.5/Apache2.4 my apache_error.log has dozens of entries like e.g.
[Wed Aug 16 18:03:27.056917 2017] [:error] [pid 12356:tid 1164] [client 127.0.0.1:51374] PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in [filename]
I'm no PHP developer so I would appreciate it if you may find a possibility to fix this in the PmFeed cookbook - that would be really great. Thank you very much and best regards from Germany, yours ErekL. ErekL August 16, 2017, at 11:16 AM
Updated to latest version, should fix the PHP5.5 problem. ccox August 16, 2017, at 04:12 PM
preg_replace
with /e. XES September 21, 2017, at 02:01 PM This has been addressed in the new release I submitted
Now there's an issue with lastRSS and Call to undefined function tidy_repair_string"
. The recipe throws a fatal error.XES
See Also
Contributors
User notes +1: 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.