Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RSS Tip
#1
Hello,

this is a little contribution on how setup rss read in your site:

- You need MagpieRSS libs to read the rss. http://magpierss.sourceforge.net
- You need DynPages plugin to integrate the php code

1) First mkdir (extra in my example) and put all MagpieRSS files.
2) Create a php file named rss_parser.php with

Code:
<?php
require_once("extra/rss_fetch.inc");

function FeedParser($url_feed, $nb_items_affiches=10)
{
  $rss = fetch_rss($url_feed);

  if (is_array($rss->items))
   {

   $items = array_slice($rss->items, 0, $nb_items_affiches);
   $html = "<ul type='square'>\n";

   foreach ($items as $item)
    {
    $html .= "<li>";
    $titre = utf8_encode($item['title']);
    $html .= "<a href=\"".$item['link']."\" target=\"_blank\">".$titre."</a>";
    $html .= "</li>\n";
    }
   $html .= "</ul>\n";
}
return $html;
}

?>

3) Create a component in your admin panel named rssmain with,

Code:
<?php
require_once("extra/rss_parser.php");
echo '<b>My RSS Reader</b>';
echo FeedParser("http://www.myrssweb.com/articles.rss");
?>

4) Add { %rssmain% } on the desired page and it will show the rss feed, by default 10 title.



Enjoy Smile
Reply


Messages In This Thread
RSS Tip - by phpliker - 2011-03-20, 23:17:18
RSS Tip - by Connie - 2011-03-20, 23:31:00
RSS Tip - by Oleg06 - 2011-03-21, 00:22:55



Users browsing this thread: 1 Guest(s)