Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
Archive
SilverStripe Forums » Archive » Can I use the RSS Widget for a regular SS page and not in blog?
Our old forums are still available as a read-only archive.
|
Page:
1
|
Go to End | |
| Author | Topic: Can I use the RSS Widget for a regular SS page and not in blog? | 392 Views |
-
Can I use the RSS Widget for a regular SS page and not in blog?

31 October 2008 at 2:48pm
Hey folks,
wondering if there was a simple way to parse RSS feeds on my homepage for an external blog. I need to use an external websites RSS for the news section of my SS site. For example it would list the last 5 posts from the blog. I looked at the RSS Widget but it looked like that was strictly for the blog (maybe)? Can this widget be used for standard ss pages? If so how? Please note that I am a newb in the world of SS.
Thanks! -
Re: Can I use the RSS Widget for a regular SS page and not in blog?

31 October 2008 at 3:45pm
yep you can. Well you dont need to use the widget, you could just copy how the widget does it in your own homepage.
function CustomRSSFeed() {
$feed = new SimplePie(URL OF THE RSS FEED);
$feed->feed->init();
$output = new DataObjectSet();
if($items = $feed->feed->get_items(0, 10)) {
foreach($items as $item) {
$output->push(new ArrayData(array(
"Title" => $item->get_title(),
"Link" => $item->get_link()
)));
}
}
return $output;
}
I think might work in 2.2.2. If your template you would do <% control CustomRSSFeed %>$Title<% end_control %> -
Re: Can I use the RSS Widget for a regular SS page and not in blog?

2 November 2008 at 7:48am
Wasn't working so I looked under the hood and see that I am running 2.2.1. Now debating whether to upgrade or to see if there is an easy work-around for this version.. suggestions?
thanks for all your help! -
Re: Can I use the RSS Widget for a regular SS page and not in blog?

4 November 2008 at 12:59pm
uh oh. Error message. not sure if its because i tinkered with your code or anther reason but on rebuild of the db the i get an error towards the bottom of the build list. help!
<code>Group_Unsecure
Member
Member_UnsubscribeRecord
Permission
Widget
WidgetArea
ERROR:
ErrorThe website server has not been able to respond to your request</code>
-
Re: Can I use the RSS Widget for a regular SS page and not in blog?

4 November 2008 at 1:04pm
ERROR:
ErrorThe website server has not been able to respond to your request
is the standard error page. Turn on more useful error messaging by putting the site in dev mode. Add this to your mysite/_config.php file - Director::set_environment_type("dev"); This will output a proper error.
-
Re: Can I use the RSS Widget for a regular SS page and not in blog?

4 November 2008 at 1:20pm
hmmmmmm. Don't think it was the config file but the server is completely not responding now. I have a feeling i mucked up the db. Is there such a thing as the constant loading white screen of death?
-
Re: Can I use the RSS Widget for a regular SS page and not in blog?

5 November 2008 at 1:10am
I resolved all other problems and can get bakc to my RSS problem now...
I think my last question to you was whether your code would work in 2.2.1? I did a search and SimplePie is definately built into the core in some respect. Not sure if it's just for the blog widget though.
| 392 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: pureprop
Welcome to our latest member: Anonymous user


