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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

SimplePie Thumbnail From RSS?


Go to End


8 Posts   4245 Views

Avatar
3 midgets In a man suit

Community Member, 13 Posts

13 November 2009 at 9:28am

Hi how can I pull thumbnails from an RSS Feed with the simple pie plugin?

everything else works great I looked on the simplepie documentation on it's website.
here is what I tried but it failed...

http://pastie.org/696188

Thanks for any help

Avatar
ChrisBryer

Community Member, 95 Posts

13 November 2009 at 5:33pm

from what i've read, the restfulservice is based on simplepie.
this page should help:

http://doc.silverstripe.org/doku.php?id=restfulservice#how_to_use_restfulservice_to_easily_embed_an_rss_feed

you can target the xml nodes through statements like
$value->Title
$value->Link
$value->pubDate

hope it helps,
-Chris

Avatar
3 midgets In a man suit

Community Member, 13 Posts

14 November 2009 at 4:50am

Fatal error: Call to undefined function curl_init() in \sapphire\api\RestfulService.php on line 96

any ideas?

Avatar
ChrisBryer

Community Member, 95 Posts

14 November 2009 at 4:54am

if you're on wamp, make sure php_curl is turned on in php.ini

Avatar
3 midgets In a man suit

Community Member, 13 Posts

14 November 2009 at 9:47pm

Well that was the issue, but now a new issue. the example give works great with the feed from delicous if I return any other rss feed url I get nada. no errors just no results

Avatar
3 midgets In a man suit

Community Member, 13 Posts

15 November 2009 at 10:56am

ok I almost have it working but, the item is called <photo:thumbnail>

how do I call it? also for somereason it won't let me strip the tags from the description

function RestfulLinks(){
$output = new DataObjectSet();
$feed = new RestfulService("http://feeds.nbcdfw.com/nbcdfw/news/sports");
$feedXML = $feed->request()->getBody();
$result = $feed->getValues($feedXML, 'channel', 'item');
foreach ($result as $key => $value) {

			$title = new Text('Title');
			$title->setValue($value->title);
			
			$desc = new HTMLText('Description');
                        $desc->setValue(strip_tags($value->description));
						
		$output->push(new ArrayData(array(
               'Title'         => $title,
               'Description'         => $desc,
                )));
}         
         
		 return $output;
		 
}	

Avatar
dalesaurus

Community Member, 283 Posts

17 November 2009 at 6:03am

Right, you're going to have to customize your parsing rules for whatever feed you're ingesting.

Have you tried casting the data into a string first? ie.

$desc = strip_tags((string)$value->description);

Also, you shouldn't have to create a new Text() and HTMLText() for each item before putting it in the DataObjectSet. You can just leave it as a plain old string.

Avatar
ChrisBryer

Community Member, 95 Posts

17 November 2009 at 8:13am

as far as the <photo:thumbnail> node is concerned, i've never tried parsing a namespaced node, but here are some thoughts..
$result is an array, so you may be able to use $value['photo:thumbnail'].

you could also try entering Debug::dump($value) to print out all the child nodes of $value.

hope it helps,
-Chris