About This
I am Michael Tyson, and I run A Tasty Pixel. I write on a variety of technology and software development topics as I travel around Europe in a motorhome.
-
Subscribe to updates 488 feed subscribers
Follow me on Twitter 964 followers
Our Products
Newsletter
Let us keep you informed about important updates, special offers, and new products. Just type in your email address below and hit enter to sign up!
-
Recent Posts
Topics
Audio Business Career Cocoa Code Data Debugging Demo Design Development Google Graphics Interface iPad iPhone Lifestyle Links Location Loopy Loopy HD Mac Maps Marketing Networking Optimisation PHP Scripts Security Shell Social Comment Software Talkie Talkie-for-Mac The Cartographer Travel Tutorial Twitter Update Utility Web WordPress WordPress Plugins WordPress Themes Workflow XCode




RSS aggregation for PHP
I have written a mechanism in PHP that can take several RSS feeds, filter and manipulate them, and re-display them in either RSS or straight HTML.
This can also manipulate content (through the preg_replace function, and configurable per-feed), such as removing names from Twitter entries. I’m using it on loopyapp.com to show all relevant items from both this blog and my Twitter feed automatically, as an alternative to creating a separate blog. I’m also using it on this blog, to incorporate blog entries and Twitter postings.
It uses the MagpieRSS RSS parser for PHP, which provides some nice functionality, including caching.
Here’s the code: aggregate.zip
To use it, unzip it to somewhere in your webroot, then edit aggregate.php and possibly rss.php to set your configuration. Make sure that either the aggregate directory is writable, or create a ‘cache’ directory within and make that writeable, to enable caching. Point your web browser to the rss.php file to immediately view an RSS feed aggregating your supplied feeds. To add a link to the RSS from a website, add it in the header:
To include content in a website, the provided render_aggregate_items function will do most of the work, or you can write your own rendering code. You just have to include the file, use the functions to obtain and draw the content, and then provide your own CSS styling. Example:
A more comprehensive example is in sample.php.
The code is GPL, so use it however you want – keep the header comments there, though.