The “Really Simple” part of RSS is sometimes misleading. What if you want to pull in content from an RSS feed and display it on your site? Doing that from scratch would be no-so-easy, but thankfully we have wonderful SimplePie to do the heavy lifting for us. In this screencast we build a really simple site that grabs content from multiple RSS feeds, smushes them together, and displays them using our own custom markup.
Links from Video:
Cool Screen cast Safari 4.0 beat is awesome
I mean Beta
The Safari 4.0 Beta is very nice. I think they use OpenGL on Windows (I think, not sure). Anyways, Simplepie has always been on my favorite list of well made extensions. It gives full editing without fully having to mess with the internals.
Anyways, I’ll stop the rambling (poor at that) and get to what I really wanted to ask:
Any chance of touching on Joomla template development? I know you’re giving away the development book, for which I know the publisher is just amazing for their books, but is there any chance that you could pique our interests with some example template design?
Thanks for the screencast, again! :)
I agree with Matt; could you perhaps tacle Joomla! the same way you took down WordPress (creating a theme from a PS layout)?
Thanks so much, I finally have the courage to digg my teeth into SP. I didn’t realize it was that easy o_O
Great screen cast! I think that it is helpful to know that there is also a SimplePie plugin for WordPress. I think that you can download it from the SimplePie page. Simple Pie is rad and I used it on the bottom of my site (http://benjaminal.com) to just keep up with friends and family whose blogs we follow. The fun part of SimplePie is being able to style the feeds.
Multiple Twitter feeds are cool too.
Unfortunately, I can’t watch the screencast from my office for some reason (some kind of proxy issue probably) but I’ve tried to use the wordpress plugin in the past and always had issues. Maybe it’s just me though.
Is it easier to just code in simplepie yourself to a theme?
This is what I did with Simple Pie http://sermons.beimmersed.com let me know if you want the code.
Thanks Chris! I’ve used magpierss in the past which worked fine for me but this is so much easier! Another great screencast!
Am I the only one that has issues opening up these videos in itunes? I subscribe to the podcast there, and every so often it simply won’t play. Plays fine here.
Running Leopard, and the latest version of itunes.
I checked the code in the demo page, hadn’t seen the screencast yet, and I see the feeds are actually rendered as HTML.
Can someone confirm this please?
That’s the whole point =)
It pulls in the feed and renders as HTML so you can style to your heart’s content.
The entire point to glorified RSS =)
On a side note, does the iPhone/iPod Touch version of Safari have an RSS reader like Safari does on the Mac side? (sleek, blue, easy to scroll through?)
110% agree. More SEO friendly pages with relevant content for the visitors. Awesome!
Nice job on this screencast, Chris! You seemed really natural and relaxed. Great tutorial too, I’m working on a site that will be using this awesome plugin too, can’t wait to show it off! :D
This is Ryan from the SImplePie project. Great screencast! Here are a few additional notes for those following along:
1) No, loading simplepie.inc doesn’t have a big load on the in-browser code, as it all runs on the server. Also, a large portion of that file size is from code comments. Lastly, it’s important to remember that making things easy is hard. :)
2) For a PopURLs clone using SimplePie, check out NewsBlocks (http://newsblocks.simplepie.org)
3) For the IDN folder, if you load it and include the include inside it, SimplePie will support Internationalized Domain Names.
4) Caching is enabled by default, and writes to ‘./cache’ unless you tell it to write someplace else, and defaults to 1 hour.
5) $feed->handle_content_type() deals with the character encoding (e.g. UTF-8) for the page. You could also use PHP’s header() function or even the tag to set the output to UTF-8.
6) Check out some details on cache folder permissions. http://simplepie.org/wiki/setup/setup#step_3
7) We’ve spent tons of time writing documentation for the entire API. That being said, if something doesn’t quite work the way you expect (such as $item->get_author() which returns another object with sub-methods) read the docs, then hit us up on the support forums. :)
Great screencast, Chris! I recently used SimplePie in another project, and wrote a tutorial for how to use it with Flickr that’s on NETTUTS+ (http://is.gd/kQ4C)
Love your work :)
Regarding your comment at about 12:30 into the video when you said “is that an array?” No.
$feed is an object. When assigning or accessing values in an object you use the -> operator, in an array the operator is =>
Also, if it were an array it would have been declared as $feed = array(); any time you see $variable = new function(); the keyword new is the clue that you’re creating an object. :)
Also regarding permissions…
If you set the owner of the folder to the username that the web server runs as you can grant write permissions to the user, and leave the rest empty.
So the permissions would be 600, or 644 (if you want it world readable). there’s no need to have execution access set because you’re not running any cgi scripts from the folder.
Great screencast. I’m interested in your thoughts, as an rss reader and publisher: When does reproducing rss feeds infringe on copyrights? Do you protect your content? Do you obtain permission from authors before reproducing headlines, previews or full articles? Is it fair that some websites are creating revenues (web traffic) from work they didn’t create? Just some thoughts…
Do you have to create separate feed objects if you don’t want to smush them all together?
thank you for this post. It helps a lot.
How do you diferantiate between 2 or more diffrent feed arrays on the same page for two or more diffrent markups, such as popurls?
By default SimplePie smushes together all the feeds into one group and sorts it by date, so the feed items are intermingled.
Actually if you wanted to present 3 feeds seperately as on PopUrls you would be better off using 3 instances of SimplePie.
Wow! You’ve done it again. Basically, your tutorials are shaping all the work I do. Thank you.
This was very useful. Haven’t been on this website before but hey, let’s add it to my combined brandnew RSS-feed!
Thanks and keep it going. The tutorial was very clear.
First time in 12 years working online that I’ve watched a screencast all the way through!
Loving your work (and loving SimplePie).
Nice tutorial. My first time watching your screencast, would be watching more :)
One thing though, white spaces above the DOCTYPE trips IE 6 to quirks mode so it might be better to have the tag start right after your first php block. …?><!DOCTYPE…
I have a feeling this is an old wives tale. Not 100% sure though and haven’t run any tests, but there is conflicting stuff out there on if this “whitespace before DOCTYPE triggers quirks mode” thing.
Nice work, Chris.
A quick, non-web-related critique:
Use Audacity or some other audio program (or whatever video software you might be using) to compress your audio so there’s isn’t such a dynamic shift in volume when you’re far away from your mic then get close up.
Is it possible to setup SimplePie to have a website displaying multiples feeds, but :
when you click on a feed “item” (permalink), instead of going to the item’s full article on the feed’s website, you dispaly the article on your own website, with your style (and of course you provide a link to the original source / item’s article on feed’s website).
Kind of, instead of that:
list of feeds > list of items > original article on feed website.
list of feeds > list of items > content > (link to original article on feed website).
Thanks in advance for enlighting me.
Gian, I hacked it for google news. I was able to do it because google news has a set format for the URL and the same number of characters from the beginning of the feed string until the point where the source URL appears. User the ‘substr’ command in PHP to slice off the portion of the URL string that contains the source URL.
is there a way to set the number of items that are displayed?
i know there’s set_item_limit, but that only limits the items from each feed. what if you have a “feedsmusher” and want to limit the number of items that smusher is displaying?
You can totally tell you’re from Wisconsin. I went to school at Marquette.
Great video! But please, please, please get another microphone or compress the sound… the volume shifts like crazy :(
has no one gotten the gzinflate data error running the demo files? i found the issue on simplepie bug list but found no solution. any ideas?
also trying to pull feeds from digg.com wasn’t working for me till i got the entire rss url for digg. anyone had this issue as well? any ideas? chris’s video and others using digg as an example just use digg.com as the url.
Awesome tutorials. I’ve looking for this information forever. Thanks for all your hard work.
Can I make one recommendation about the video player. The Viddler.com video player enables you to create a video table of contents. So for example if your tutorial has 5 steps. You can creat a Hyperlink for each step and it will play start playing that part of the video at that specific point.
It took me forever to to find something you said earlier.
Be well– and thanks for the insightful video tutorials.
For some reason, when I run the demo files on my server, there are no errors but nothing happens. I have tested the compatibility, and I am running all the required functions.
Here’s my test page if you want to have a look at it – http://feedme.net23.net/test.php
Please help :(
Great tutorial! Complete and easy to follow. I’m starting to learn and use SimplePie, and it looks easier when I watched this video. Thank you!
Great video/tutorial. Really easy to follow and I love your humor!
Hi Chris, great video, very helpful.
Was wondering if you could shed some light on the error message: cURL error 6: Couldn’t resolve host ‘simplepie.org’
This code below is what I used, pretty much identical to what you had, but no matter what I put in the feed (an array or just one) it comes up with this error message. I have spent the whole night going through this, trying different settings. Nothing works :-(
I tried the compatibility test and received: You have everything you need to run SimplePie properly! Congratulations! so that shouldn’t be the problem. Researhing the code on the internet doesn’t come up with anything useful. Most explainatory I could find was:
This error message indicates that you don’t have a server selected for the account to be setup on. Check you have a default server set in Setup > Servers (denoted by an asterisk *) and that a server is selected on the account that you are trying to setup. (from WHMCS.com)
I don’t know anything about php, but thought I could show the posts from my own wordpress blog on my (currently) static website made in Dreamweaver.
Any tips where to look, or even what to ask my server provider what to do would be greatly appreciated!
Have a great weekend!
(PS the page below is the entire php page as I want to make sure I get something returned first before I try to apply any style, template, looks etc and this is all it returns: blablabla hhh cURL error 6: Couldn’t resolve host ‘simplepie.org’)
<a href="get_permalink(); ?>”>get_title(); ?>
sorry, I just noticed it has made a weird mess of my code :-( I don’t know how to paste the code in here to make it show up like it is in my Dreamweaver page…
Is it possible to have the feeds display, in the same order that I put them in when I defined them in the “$feed->set_feed_url(array(“. And limit them to just the newest feed, one at a time?
Thanks for the great tutorial. I am trying to fetch feed from multiple sources using the $feed->set_feed_url(array()); However, it does nothing. no error message nothing thrown. the code works seamlessly when trying to process just one feed without using array()
//provide the caching folder
//set the amount of seconds you want to cache the feed
// Run SimplePie.
// This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn’t change it).
Sample SimplePie Page
did some further digging and figured out that the issue is around trying to fetch the favicon for these feeds.
h2 style=”background:url(get_feed(); echo $feed->get_favicon(); ?>) no-repeat; text-indent: 25px; margin: 0 0 10px;”>
Awesome tutorial, although I do not see any .inc files in the new download at simplepie.org I was wondering how to use this with wordpress and what file would be needed to include with the newer version. I also have noticed a simplepie folder in the standard wordpress 3.5.1 install. I have tried everything to get a google calendar xml to parse successfully with the built in rss widget in wordpress. I am hoping to overcome this issue using simplepie and building a custom plugin using it. Please be of any help