2011-03-20, 23:17:18
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
3) Create a component in your admin panel named rssmain with,
4) Add { %rssmain% } on the desired page and it will show the rss feed, by default 10 title.
Enjoy
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