Introducing the gFeed

The other morning I was looking for an easy way to test all my feeds. After a few minutes of tracking down the latest magpierss and some lunchtime programming, I’m happy to present the gFeed.

The gFeed pulls all my posts at, the First Crack Podcast,, the Work Better Weblog, and my Flickr Gallery into a single site and single RSS.

Currently it’s a straight text and image feed, no mp3 enclosures (i.e. podcasts) or links in the post’s body. For now, you’ll have to click over to the original post for that stuff.

I’m not sure if the gFeed will be useful to anyone but myself, let me know either way.

If you’re interested in how I modified magpierss to aggregate the sites, continue reading.

  1. Open up a magpie_simple.php and create an array (I put it at line 3) with all the sites you want to aggregate:
    $urls = array (
  2. After that, create an array for all the posts to live in.

    $allitems = array();
  3. Now replace magpie’s existing ‘if ($url)’ with ‘foreach($urls as $url)’ like this

    Change this:

    if ( $url ) {
    	$rss = fetch_rss($url);

    To This:

    foreach ($urls as $url) {
    	$rss = fetch_rss($url);
  4. Next, I grab the title and link from each of the specified feeds and parse through each of the items in the feeds. For each item in the feed, I grab the title, link, description, publication date, guid, and timestamp.
    	$channel = $rss->channel['title'];
    	$channellink = $rss->channel['link'];
             foreach ($rss->items as $item) {
    		$title = $item['title'];
    		$href = $item['link'];
    		$desc = $item['description'];
    		$date = $item['pubdate'];
    		$guid = $item['guid'];
    		$ts = $item['date_timestamp'];
  5. Before closing out the ‘foreach()’ function, I add all that data to the $allitems array.
        array_push($allitems, array($ts,
              "channel" =>$channel,
              "channellink" => $channellink,
              "title" => $title,
              "href" =>$href,
              "pubdate" =>$date,
  6. Now, sort all the items by their timestamp
  7. Finally, we spit out the items:
    foreach ($allitems as $item) {
    	echo $item['href'];
    	echo $item['title'];
    	echo $item['desc'];
    	echo $item['channellink'];
    	echo $item['channel'];

Hope this is helpful in creating your own personal gFeed, or jFeed, or cFeed, or whathaveyou.