I am working on a company website that has several subsites all in postnuke...
I would like to create one block on the main site that would have all the rss feeds for all the subsites listed...
Preferrebly it would be one list and the feeds would be intermeshed so the latest story, no matter which site, is on the top...
I can do this with My Headlines and latest news but can't seem to get that to appear ont he front page.. Any suggestions?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Multiple RSS Feeds in one block
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 17
If you can almost do what you want to do with MyHeadlines, then you may want to start there ... and search for some help with MyHeadlines. (I am not familiar with that app/module, so I can't help you there.)
I use a script called Magpie RSS (http://magpierss.sourceforge.net/), but this is not a pnBlock or pnModule so you would have to add a PHP block to your site and paste the proper code there. The Magpie RSS website has some pretty good examples of code, as well as decent installation instructions. Magpie have had the best luck with Magpie RSS when it comes to displaying feeds from various different sites -- and I have a script that I have written to allow multiple feeds in one block. (See a jpg example using the 3 PostNuke sites' RSS feeds here.) But I do not combine the feeds like you are suggesting ... though I suppose you could modify script to build an array of items (instead of just displaying them) from multiple sites, then sort the array, and then finally display the array.
Here is my PHP script, if you are interested. This script is placed in a PHP Block on the home page -- but this script will only work if you have the Magpie Script files installed on your server!
Code
// comma separated RSS URLs
$URL = 'http://news.postnuke.com/backend.php,
http://mods.postnuke.com/backend.php,
http://blocks.postnuke.com/backend.php';
$stripHTML = 1;
$maxItems = 2;
$showSiteTitle = 1;
$siteTitlePosition = 1; // 0=top, 1=bottom
$showItemBullet = 0;
$showContentData = 0;
$showSeparator = 1;
$showItemDesc = 1;
$maxDesc = 80; // recommended only if $stripHTML=1
$RssFont = "Arial";
$SiteTitleSize = "9px";
$ItemTitleSize = "12px";
$ItemDescSize = "9px";
$TableCellPadding = "3";
define('MAGPIE_CACHE_DIR', '/MyDomainPath/tmp/rsscache');
define('MAGPIE_CACHE_ON', 1);
define('MAGPIE_DIR', '/MyDomainPath/htdocs/rss-parser/');
require_once(MAGPIE_DIR.'rss_fetch.inc');
$feeds = split(",", $URL);
$displayedOneFeed = 0;
foreach ($feeds as $URL) {
// code for displaying the separator <HR>
if ($displayedOneFeed) {
if ($showSeparator) {
echo "<SPAN style=\"font-family:arial; font-size:4px;\"><HR></SPAN>";
} else {
echo "<SPAN style=\"font-family:arial; font-size:4px;\"><BR><BR></SPAN>";
}
}
$rss = fetch_rss( trim($URL) );
if ($rss) {
$items = array_slice($rss->items, 0, $maxItems);
echo "<table border=0 cellspacing=0 cellpadding=".$TableCellPadding.">";
if(($showSiteTitle) && ($siteTitlePosition==0)) {
echo "<tr valign=\"top\"><td ";
if ($showItemBullet) {
echo "COLSPAN=2 ";
}
echo "style=\"font-family:$RssFont; font-size:".$SiteTitleSize.";\"><a href=\"" . $rss->channel['link'] . "\" style=\"font-family:".$RssFont."; font-size:".$SiteTitleSize.";\"><b>" . $rss->channel['title'] . "</b></a></td></tr>";
}
$trans = array("<BR>" => " ", "<BR />" => " ", "<BR/>" => " ", "<br>" => " ", "<br />" => " ", "<br/>" => " ", "</P>" => " ", "</p>" => " ");
$numdisplayed = 0;
foreach ($rss->items as $item) {
$numdisplayed++;
if ($numdisplayed > $maxItems) { break; }
$href = $item['link'];
$title = $item['title'];
$contentArray = $item['content'];
$content = $contentArray['encoded'];
if ($stripHTML) {
$converted = trim(strip_tags(strtr(strtr($item['description'],$trans), array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)))),"\xA0"); // strips whitespace including non-breaking-spaces ( )
} else {
$converted = $item['description'];
}
if ((strlen($converted) > $maxDesc) && ($maxDesc <> 0)) {
$desc = rtrim(substr($converted,0,$maxDesc),'A..Za..z') . ' ...';
} else {
$desc = $converted;
}
echo "<tr valign=\"top\">";
if ($showItemBullet) {
echo "<td>•</td>";
}
if (($showContentData) && ($content <> '')) {
echo "<td>".$content."</td>";
} else {
if ($showItemDesc) {
echo "<td style=\"font-family:".$RssFont."; font-size:".$ItemDescSize.";\"><a href=\"$href\" style=\"font-family:".$RssFont."; font-size:".$ItemTitleSize.";\"><b>$title</b></a><BR>$desc</td>";
} else {
echo "<td style=\"font-family:".$RssFont."; font-size:".$ItemTitleSize.";\"><a href=\"$href\" style=\"font-family:".$RssFont."; font-size:".$ItemTitleSize.";\"><b>$title</b></a></td>";
}
}
echo "</tr>";
} // end For Each
if(($showSiteTitle) && ($siteTitlePosition)) {
echo "<tr valign=\"top\"><td ";
if ($showItemBullet) {
echo "COLSPAN=2 ";
}
echo "style=\"font-family:$RssFont; font-size:".$SiteTitleSize.";\"><a href=\"" . $rss->channel['link'] . "\" style=\"font-family:".$RssFont."; font-size:".$SiteTitleSize.";\"><b>" . $rss->channel['title'] . "</b></a></td></tr>";
}
echo "</table>";
} else {
echo "<span style=\"font-family:".$RssFont."; font-size:".$SiteTitleSize.";\">An error occured! " . "<br>Error Message: " . magpie_error() . "</span>";
}
$displayedOneFeed = 1;
} // end For Each
Good Luck. (Sorry for the bloated post.) -
**unknown user**
- Rank: Helper
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 569
sounds like you want one of those old javascript newsscrollers. You can find them at moreover and syndic8 and webmonkey and....all over.
Also, you could just make 3 PN RSS blocks and make the border=0 around em' -
**unknown user**
- Rank: Expert
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 1193
Actually, you could use the RSSdisplay module (from http://www.mtrad.com). To combine the three feeds, you need to write some PHP code to do 3 calls to rssdisplay.php and insert that code into a PN PHP-type block. (There's an example in the RSSdisplay module on doing something similar...) BTW, RSSdisplay uses Magpie to retrieve RSS feeds and it also includes options for scrollers and other presentation modes.
If you're trying to generate RSS feeds from your own site (or a multi-sites implementation which has access to all of the tables you're interested in), you can modify the RSSfeed module (also from http://www.mtrad.com) to generate the feed. (You need to send me an email to crsATmtradDOTcom, requesting the current version of RSSfeed, as this functionality isn't yet public. I expect to release it as v2 sometime this week.)
A complete solution for you would be the RSSaggregate module, which will also be from http://www.mtrad.com, once it's written!
We've got it designed but no one (yet) has had the time to implement it. The RSSaggregate module would allow you to aggregate any number of RSS feeds (from any source) into what looks like a single feed.
- Moderated by:
- Support
