RssFeedDisplay-Talk

Summary: Talk Page for RssFeedDisplay
Categories: RSS

Comments & Bugs


2007-06-03

Current version contains some strange code for handling non-ASCII characters:

    list($description,$title)= 
    preg_replace('/([^\x00-\x7f])/e','sprintf("&#%d;", ord($1))',array($description,$title));

If it breaks unicode characters you should remove these lines and add into your config.php (change utf-8 to your encoding):

 define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');

Anomen

  • for me change at this way the encoding of the title (what I want), but change it to the bad side for the messages :-(
st April 22, 2009, at 08:25 AM

Feb 10, 2007

rssdisplay was not showing the summaries from Atom feeds. To fix this, go through rssdisplay.php and replace all instances of "atom_content" with "summary".

--Dominique Cimafranca


July 19th 2006

Should Magpie be styling the RSS I just get a link in my Wiki when i add the markup (:RSS [(approve links) edit diff] long 5:) When you click on the link it brings you to the xml file. \ Thanks


Feb 8th, 2006

The font size of the RSS Feed is very big compared to other sections in my website in IE6. How do I control the font size of the feed being display.

I have found a work-around for this problem. I am doing the following to reduce the font size: [-(RSS: :)-]

The [- and the -] help in reducing the font in IE6. But this reduces the font to much smaller size in Konqueror. How do I apply this style to IE alone. Any way of doing this.


  • utf8 handling, character handling
  • I've tried to use it, but there was no effect: the markup didn't work at all. What did I get? just: RSS [(approve links) edit diff], plain written in my site - that was all! Is there a special version of magpie, that should be used for?
    • With the latest version of magpie in hand, I've found that if you set up magpie according to its included INSTALL and README files, that literally should take care of server-side RSS configuration (assuming the caveats magpie talks about, including your web server's ability to handle the software). Also, don't just press "Preview" to see if the RSS feed works; you have to "Save" the page to see the results. Otherwise, refer to the other comments here. -- maestro7
  • If you see no output when you include an RSS feed you shoul try and validate the RSS feed. I had an encoding problem with my feed and Apache, after fixing that everything worked! I checked with http://www.feedvalidator.org/
  • Nice little extension. I modified it to my taste and setup my feed reader here. Greetings from SatishGoda.
    • right, however you can use the class .rss to correct the looks.
    • in short mode there is nearly no chance to see where one link ends and another begins - there should be a list as output
    • JS? April 28, 2005, at 08:10 AM
  • For "long" and "short" displays, I hacked the code (I'll show it here; I didn't do a very good job of commenting, etc., so I won't spoil the complete package on this server!):
        if ( $what == 'short' ) {
          $line .= "[$link<BR>\n";
          $line .= "<BR>";
        }
        if ( $what == 'long' ) {
          $line .= "[$link<BR>\n";
          $line .=  $description . "<BR>";
          $line .= "<BR>";
  • ...the above suits my purposes just fine. The "[" are merely visual "seperaters" for each item, and I inserted <BR> where it made sense to me for visual coherency.
  • Issue with PHP 5.1 and Magpie After ugrading to PHP 5.1.1 the following errors are generated:
    Warning: gmmktime() expects parameter 3 to be long, string given in pmwiki/local/magpie/rss_utils.inc on line 35
    The simple solution is to edit rss_utils.inc and change the line:
      $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
    
    to this one:
     $epoch = gmmktime( $hours, $minutes, $seconds+0, $month, $day, $year);
    
    -- RenaudBompuis  25 Dec 2005

18 Nov 2005

This is great! I did have a difficulty. I found this feed at <[(approve links) edit diff]. It seems to generate faulty output with the script, though as far as I can tell it is a valid feed item.

 <item>
  <title>FDA Seeks Public Input on Renewal Process for Prescription Drug User Fee Act (PDUFA)</title> 
  <description>FDA) will begin the public process toward reauthorization of the 
Prescription Drug User Fee Act (PDUFA), the law that allows the agency to help 
fund programs that have helped product developers get early and frequent 
advice about how to develop some of the last decades' most innovative 
and important medicines.</description> 
  <pubDate>Thu, 10 Nov 2005 17:50:00 GMT</pubDate> 
  <link>http://www.fda.gov/bbs/topics/news/2005/NEW01259.html</link> 
 </item>

Here is what the output looks like.

]]

I am not sure what is happening, but it looks like an extra carriage return is being inserted before "]]". Perhaps the parentheses are doing this? Perhaps in Magpie?

-- Mike

I have no problems with this feed. Could be a magpie problem I use .61 BrBrBr


Using rssdisplay.php,v 1.31 2005/10/18, the short display produces a dense column of output - no formatting of rows, no vertical space between lines. Since I don't want to add the space via my css, so on my installation I've modified lines 64-92 to include some <BR> tags and a &bull; before each $link"

        $description=$description;
        $link="<a class='urllink' href='$href'>$title</a><BR>";
          $line .= "<h3 class='rss$what'>• $link</h3><BR>\n";
        if ( $what == 'long' ) {
          $line .=  $description . "<br /><BR>\n";
        }
 -- Tegan Dowling (Thanks for a terrific recipe!)

Adding the date

You can easily add the date to each item. Here is an example of a modification to the "modified script" (from above). First, change the include statement to this.

 include_once("$FarmD/local/magpie/rss_fetch.inc");
 include_once("$FarmD/local/magpie/rss_utils.inc");

Next, add the following to output.

 # Original lines are below.
    foreach ($items as $item)
    {
     $output .= '* %newwin% [['
     . $item['link']
     . "|"
     . $item['title']
     . "]]";
 # Newly added lines are below.
 # Reference: http://cz.php.net/manual/en/function.date.php
 # Reference: http://www.cadenhead.org/workbench/entry/2004/06/17
     $date = "";
     $rss_2_date = $item['pubdate'];
     $rss_1_date = $item['dc']['date'];
     $rss_3_date = $item['prism']['publicationDate'];
     $atom_date = $item['issued'];
     if ($atom_date != "") $date = parse_w3cdtf($atom_date);
     if ($rss_1_date != "") $date = parse_w3cdtf($rss_1_date);
     if ($rss_2_date != "") $date = strtotime($rss_2_date);
     if ($rss_3_date != "") $date = parse_w3cdtf($rss_3_date);
     if ($date == '-1') {
      if ($atom_date != "") $date = strtotime($atom_date);
      if ($rss_1_date != "") $date = strtotime($rss_1_date);
      if ($rss_3_date != "") $date = strtotime($rss_3_date);
     }
     if (($date != "") && ($date != '-1')) {
      $secondsinaday = 60 * 60 * 24;
      $dateformat = 'd M Y';
      $today = time();
      $yesterday = time() - $secondsinaday;
      $datetoday = date($dateformat, $today);
      $dateyesterday = date($dateformat, $yesterday);
      $daterss = date($dateformat, $date);
      if (($daterss == $datetoday) || ($daterss == $dateyesterday))
      {
       $color = 'red';
      }
      else {
       $color = 'gray';
      }
      $output .= '&nbsp; %' . $color . '% [-' . $daterss . '-]%%';
     }

-- Mike  07 Dec 2005

Restricting output to recent feeds

Of course, it is now easy to restrict output to recent feeds, just by adding a fourth parameter to the RSS directive. The parameter indicates how many days of feeds you want to display.

 $dayoffset = 1;
 $earliest = '';
 if (isset($parameters[3])) {
  $earliest = $today - ($parameters[3] + $dayoffset) * $secondsinaday;
 }

You then just precede the output with a condition, like this.

 if ((! isset($parameters[3])) || ($date >= $earliest) || ($date == '')) {
 ....
 }

-- Mike  07 Dec 2005

Adding an image

You can easily include the RSS images by adding these lines before the "foreach ($items as $item)" line in the modified script.

 $images = $rss->image;
 if (isset ($images['url']))
  {
   $output .= $images['url'] . "\n";
  }

-- Mike  08 Dec 2005

Domain-specific targets

You might like to specify a new window target only for links to other domains. Here is how.

 $thishost = $_SERVER['HTTP_HOST'];
 $parsed = parse_url($item['link']);
 $target = (($thishost == $parsed['host']) ? 'same' : 'new');
 if ((! isset($parameters[3])) || ($date >= $earliest) || ($date == '')) {
                $output .=    '* '
                            . '%'
                            . $target
                            . 'win% [['
                            . $item['link']
                            . "|"
                            . $item['title']
                            . "]]";

-- Mike  15 Dec 2005


Would someone think of an easy way to have something like an aggregator that tells which post have been read by the currently logged user. Could be that, for every post you read, you tick or press a button that saves in cache the title of the post and before reloading items from xml compares to this list. I'm just a php newby so if you think of anything to code this feature... --JoelMig? July 24th, 2006 - 22:20


Talk page for the RssFeedDisplay recipe (users?).