Extension talk:FeedImport
Add topicSuggested bug fixes as of 03-June-2008:
[edit]Feed items with no description will trigger a PHP Notice of "Notice: Undefined index: description"
Find
if ($item["description"]) {
replace with
if (!empty($item["description"])) {
Suggested bug fixes as of 10-August-2007:
[edit]To avoid MAGPIE_DIR already defined error, at line 44 replace
define('MAGPIE_DIR', '/opt/local/lib/php/magpierss/');
with
if (!isset(MAGPIE_DIR)) { define('MAGPIE_DIR', '/opt/local/lib/php/magpierss/'); }
and to avoid short is undefined error, fix the mistake at line 106:
$reverse = isset($args["short"]);
should be
$short = isset($args["short"]);
- Your changes have been merged. Thanks for your help. --PhilFry 13:21, 11 August 2007 (UTC)
Version Support
[edit]What versions of mediawiki does this work with? I am hoping 1.7.
- I have only tested it with 1.9 and 1.10 --PhilFry 01:56, 8 September 2007 (UTC)
Bug when using both 'filter'/'highlight' and 'max'
[edit]Move line 242 inside the last block.
if ($display) { $output.="{{".$template."\n"; $output.="|title=$title\n"; $output.="|link=$href\n"; $output.="|date=$datedisp\n"; if (!$short) { $output.="|description=$text\n"; } $output.="|creator=$creator}}\n"; if (++$headcnt == $maxheads) break; }
-- jbs
Is there any way to speed up the amount of time it takes for FeedImport to check and display RSS links
[edit]I want to increase the time to like 1-2 mins. Any ideas?
- If you want to reduce the delay between the update of a feed and that change being reflected on the wiki page you might need to change magpierss, as that's doing the caching. --PhilFry 01:56, 8 September 2007 (UTC)
- Thanks PhilFry. Yeah I'm researching that now. Any suggestions of where to modify this specifically. I have the RSS working on my own WIKI and what I am looking to do is have an instant update of New Articles from a specific NAMESPACE on the Wiki. --Zezek 02:07, 8 September 2007 (UTC)
minor bug fix at line 217
[edit]i added "isset($args["date_timestamp"]) and" to the source code available here. I got a a lot of notices like "Undefined index: date_timestamp ..." within my log files before.
Does this work with Bugzilla feeds?
[edit]I generate Bugzilla RSS feeds based on queries (e.g., a list of all open bugs for a given release), and want to include them in certain wiki pages. These work fine in the browser, but
<rss><feed-url>|template=Template:RSSTemplate</rss> (where <feed-url> equals the feed url coming from Bugzilla, which is quite long, and Template:RSSTemplate is based on the BBC template from your example) simply results in a link for the feed, but with no feed entries.
The following works fine: http://mmamania.com/feed/ . On the other hand, when I try the 'http://www.legalservices.gov.uk/xml/rss/cdsnewsupdates/rss.xml' feed (mentioned in a previous issue on this page), I just get a list of empty bullets. Thanks! -- com^lnssi^roberts^michael 1/10/08
Field "dc_creator" and usage together with News_Channel
[edit]Hi, I have two problems, when trying to use the extension:
I tried the following code:
<rss>http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml|dc_creator|charset=UTF-8|max=5|title = none|nodate</rss>
With "Template:Blogentry" created like this:
: [{{{link}}} {{{title}}}]
:: {{{description}}}
:: {{{dc_creator}}} {{{date}}}
Now I see the linked items with descriptions, without the channel title or date (very good so far). Unfortunately, instead of the creator's name or an empty string there shows up "{{{dc_creator}}}". Is this something to be set or is there an error?
Second problem: I want to use FeedImport together with the News_Channel extension, which produces a RSS or Atom feed dynamically. E.g. with an URL like this: https://wiki.mpi-cbg.de/wiki/imagepro/index.php/Special:NewsChannel?format=rss20&limit=10&wpSubmitNewsChannelParams=Get+news If I want to implement this feed (which works as a dynamic bookmark in Firefox perfectly), I get an error "Failed to load RSS feed (not array) from https://wiki.mpi-cbg.de/wiki/imagepro/index.php/Special:NewsChannel?format=rss20&limit=10&wpSubmitNewsChannelParams=Get+news"
Thanks for your work. I hope it will work in the end. --Ygramul 08:11, 2 June 2008 (UTC)
- I get the same error : No author is named, and {{{dc_creator}}} simply sits in it's place. I guess it may got something to do with the versions of MediaWiki or MagPie. It strikes me as an odd thing, such as the extension not "getting" the author value correctly from the feed. I'm on MW 1.11 --MortenB 09:48, 15 October 2008 (UTC)
Caching
[edit]Turning Caching Off
[edit]It is not mentioned in the documentation and not too easily found for the non-PHP savvy users. If you do not want feeds to be cached edit feedimport.php
Find
define('MAGPIE_CACHE_DIR', MAGPIE_DIR . 'cache/');
Add Bellow
define('MAGPIE_CACHE_ON', false);
Samll fix vor br
[edit]I've seen that there are many feeds taht include
that is only cut out and then the text does not look very nice. So I`ve made a small change
$text= str_replace("<br>","{{BR}}", $text);
$text= str_replace("<br/>","{{BR}}", $text);
$text= str_replace("<br />","{{BR}}", $text);
$text= str_replace("<BR>","{{BR}}", $text);
$text= str_replace("<BR/>","{{BR}}", $text);
$text= str_replace("<BR />","{{BR}}", $text);
I added this an but
into Template:BR
now the text is formated well. Maybe its possible to build something similar for Links and Pictures. Links would be quite easy. With pictures it could be a problem, maybe when using some extension taht allows to insert external images. --DaSch 22:55, 12 June 2008 (UTC)
Assume magpierss installed in a subdirectory by default
[edit]A convenient starting config could be to assume magpierss to be installed in extensions/magpierss, and thus define as a default
define('MAGPIE_DIR', dirname(__FILE__).'/magpierss/');
– 88.91.187.186 19:12, 1 September 2009 (UTC)
Cannot modify header information - headers already sent
[edit]Can someone help. I installed the extension and I get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/k/k/m/kkm5848/html/hindupedia/eng/extensions/feedimport/feedimport.php:325) in /home/content/k/k/m/kkm5848/html/hindupedia/eng/includes/WebResponse.php on line 10
Encoding
[edit]I've had to add following lines to fix encoding trouble :
#get charset from argument-array
$charset = @$args["charset"];
if (!$charset) $charset= $DefaultEncoding;
+
+ define('MAGPIE_OUTPUT_ENCODING', $wgOutputEncoding);
Date format / i18n
[edit]Rather use wgLang than PHP date function ...
+ $date_format = NULL;
if (isset($args["date_format"])) {
$date_format = $args["date_format"];
+ }
- } else {
- $date_format = 'r';
- }
... and ...
$dateinfo = "";
+ $datestr = "";
+ if ($item['date_timestamp']) {
+ $datestr = trim(iconv($charset,$wgOutputEncoding, $item['date_timestamp']));
+ } else if ($item['dc']['date']) {
+ $datestr = trim(iconv($charset,$wgOutputEncoding,strtotime($item['dc']['date'])));
+ }
+
+ $ts = date("YmdHis", $datestr);
+
+ if ($date_format == NULL) {
+ $dateinfo = $wgLang->timeanddate($ts);
+ } else {
+ $dateinfo = $wgLang->sprintfDate($date_format, $ts);
+ }
Item position
[edit]Enable invoke item template to known position of item to be rendered :
+ $pos = 1;
foreach ($rss->items as $item) {
$output.="|date=$datedisp\n";
+ $output.="|position=" . ($pos++) . "\n";