Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

RSS Aggregator Module not Working?


Go to End


7 Posts   2334 Views

Avatar
Samba Sam

Community Member, 85 Posts

4 November 2009 at 11:48am

Edited: 06/11/2009 5:38pm

Hi,
I can't get the RSS Aggregator module to work?
There appears to be no built-in ss template and no documentation on how to implement the module in a custom template.
I created a RSSAggregatingPage.ss with the following guesswork code, with no luck:

<ul>
<% control updateRSS %>
<li>$Title<br>$Date<a href="$Permalink" target="_blank">read more</a>$entry
<% end_control %>
</ul>

Any ideas?

Thanks,
Sam

Avatar
Samba Sam

Community Member, 85 Posts

6 November 2009 at 5:41pm

Edited: 06/11/2009 5:42pm

So, is there anyone out there who has gotten this module to work?
If so, how did you do it?
Thanks,
Sam

Avatar
Multidots

Community Member, 16 Posts

6 November 2009 at 10:28pm

Hi sam,

In default template the sidebar display the sub menu of each page. Which is used as the controller menu

<% control Menu(1) %>
<% if Children %>
<% end_if %>
<% end_control %>

so it is fetching the rrs entry at there.

I have prepared the new code to display the rss entry as per my requirement which is same as you want. So I think it is useful to you too.

Step 1 : Copy the below code and paste in /spphire/core/control/ContentController.php

public function getRSSAggregating() {
$result = DataObject::get("SiteTree", "ParentID = 0 AND ClassName='RSSAggregatingPage'");

$visible = array();
// Remove all entries the can not be viewed by the current user
// We might need to create a show in menu permission
if(isset($result)) {
foreach($result as $page) {
if($page->can('view')) {
$page->SubAggregat = $this->getRSSAggregatingchild($page->ID);
$visible[] = $page;
}
}
}

return new DataObjectSet($visible);
}

public function getRSSAggregatingchild($page_id)
{

$result_sub = DataObject::get("RSSAggEntry", "PageID = ".$page_id." AND Displayed = 1", "Date ASC");
$visible_sub = array();

if($result_sub) {
foreach($result_sub as $page_sub) {
//if($page_sub->can('view')) {
$visible_sub[] = $page_sub;
//}
}
}
return new DataObjectSet($visible_sub);

//return $visible_sub;
}

public function RSSAggregating() {
return $this->getRSSAggregating();
}

Step 2 : Copy and paste the below code in your .ss file where you want to display the RSS

<% if RSSAggregating %>
<div class="rssblock" >
<% control RSSAggregating %>
<h3 class="iblockfont"><b>$Title</b></h3>

<% if SubAggregat %>
<% control SubAggregat %>
<h4><a href="$Link">$Title</a></h4>
<% end_control %>
<% end_if %>

<% end_control %>

</div>
<% end_if %>

Avatar
Samba Sam

Community Member, 85 Posts

7 November 2009 at 4:17am

Hi,
Great, thanks for the detailed response!

Your suggestion looks very hopeful. But, I haven't able to get it work. I've entered your below code /sapphire/core/control/ContentController.php right after "class ContentController extends Controller {" and the <% if RSSAggregating %>stuff into my RSSAggregatingPage.ss file as you suggested.

I have two Yahoo RSS feeds added to the RSSAggregatingPage type in the CMS, but nothing appears on the web page.

More help would be appreciated,
Sam

PS: I am still not clear how the module was originally designed to work--
ie, how it fetches the RSS entries from a menu function?:
<% control Menu(1) %>
<% if Children %>
<% end_if %>
<% end_control %>
I am curious to know how the module was initially intended to be implemented in a template (i.e., the exact code in .ss file)

Avatar
Harley

Community Member, 165 Posts

12 November 2009 at 6:44am

Yeah I've been having similar troubles too.

Is this module going to be devolped any further? It seems crazy that you have to alter the saphire code to get what you want. I like how it works in the CMS but there is little control of how it displays on the front end. If there was a page type that would make things a great deal easier.

Thanks

Avatar
davidm2010

Community Member, 107 Posts

15 July 2010 at 9:53am

Has this module been updated for 2.4? It seems to work, but only displays the first line.

Avatar
davidm2010

Community Member, 107 Posts

24 July 2010 at 5:35am

I ended up using the Google RSS reader for my website.