Build Your Own News Aggregator with Twitter Bootstrap and SimplePie

twitter-bootstrap-simple-pie

Wouldn’t it be cool to use two great technologies to create your very own news aggregating website? Well surely it would, and that is exactly what we’re going to do. Let’s grab ourselves a copy of the latest version of Twitter Bootstrap and SimplePie and get cookin!

The tools you will need

http://simplepie.org/

SimplePie is a PHP Library that is fast and easy to use for parsing syndication feeds. We’ll use this as the engine that will grab data for our news aggregator. SimplePie will handle the heavy lifting for us on the backend.

http://getbootstrap.com/

Up front we’ll use Twitter Bootstrap 3 to give us a quick and easy way to apply a nice and professional looking front end to our site.

http://bootswatch.com/

This step is optional, but if you would prefer a different style to your design, while still using the same markup and syntax, you could choose one of the many beautiful designs from Bootswatch.

We’re going to keep this as simple as we possibly can. In fact, this site will only have one index.php page consisting of 328 lines of mixed HTML and PHP, and a handful of supporting files to be included via PHP for SimplePie and Twitter Bootstrap. This is just a quick and fun example of using these two very cool tools to build something fun.

Supporting Files and Folders

The above index.php file is meant to go in your root directory. The supporting files you need in the root directory are autoloader.php, bootstrap.min.css, and bootstrap.min.js. I told you this would be simple 🙂

There are two supporting folders; cache, and library. The cache folder contains the cached entries of the data you collect with SimplePie and the library folder contains the SimplePie.php class and the remaining SimplePie class files in a subfolder called SimplePie. Once all of this is in place, you are ready to launch your site! The picture at the beginning of this post gives an idea of what it will look like.

The PHP that makes it work

Lastly we’ll provide the actual methods used in the SimplePie object to get the data of each post you display. This will help to make sense of what is going on in the provided index.php file above.

Thank you for reading Build Your Own News Aggregator with Twitter Bootstrap and SimplePie – If you found this post helpful, Please do share using the buttons below!