From: <sm...@us...> - 2013-10-02 20:01:00
|
Revision: 12571 http://sourceforge.net/p/plplot/code/12571 Author: smekal Date: 2013-10-02 20:00:56 +0000 (Wed, 02 Oct 2013) Log Message: ----------- New link to plplot News rss feed taken directly from plplot sourceforge project page. Number of news items limited by breaking foreach loop after $newscount items. Item description needs to be stripped of HTML tags, since new rss feed adds some HTML tags (old news feed didn't contain suchs tags). Modified Paths: -------------- trunk/www/corefunctions.php Modified: trunk/www/corefunctions.php =================================================================== --- trunk/www/corefunctions.php 2013-10-02 19:52:29 UTC (rev 12570) +++ trunk/www/corefunctions.php 2013-10-02 20:00:56 UTC (rev 12571) @@ -95,13 +95,10 @@ // function pageNews($newscount, $contentlength) { - // Open the PLplot News RSS feed and parse it - // Options for sourceforge news feed can be looked up at this link: - // http://sourceforge.net/apps/trac/sourceforge/wiki/API + // Open the PLplot News RSS feed and parse it (rss link taken from the plplot project page) $feed = new SimplePie(); $feed->enable_cache(false); // disable cache - $url = sprintf("http://sourceforge.net/api/news/index/project-id/2915/limit/%d/rss", $newscount); - $feed->set_feed_url($url); + $feed->set_feed_url("http://sourceforge.net/p/plplot/news/feed"); $feed->init(); $feed->handle_content_type(); @@ -112,10 +109,15 @@ // show news items if($feed->data) { $items = $feed->get_items(); + $i = 0; foreach($items as $item) { - echo '<h4><a href="' . $item->get_permalink() . '">' . $item->get_title() . '</a></h4>'; - echo '<p>' . _substr($item->get_content(), $contentlength) . ' '; - echo '<a href="' . $item->get_permalink() . '">Read more</a> (' . $item->get_date('j M Y') . ')</p>'; + echo '<h4><a href="' . $item->get_permalink() . '">' . $item->get_title() . '</a></h4>' . "\n"; + echo '<p>' . _substr(strip_tags($item->get_content()), $contentlength) . ' '; + echo '<a href="' . $item->get_permalink() . '">Read more</a> (' . $item->get_date('j M Y') . ')</p>' . "\n"; + + $i = $i + 1; + if( $i >= $newscount ) + break; } } else echo '<p>Could not open <a href="' . $url . '">News feed</a>!</p>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |