brandnewbox.co.uk

Home of Andrew Weaver, a uk-based web developer specialised in building high-quality websites

ExpressionEngine FeedGrab plugin tutorial

Thursday, December 14th, 2006

Andrew Weaver

Category: , ,

This tutorial will guide you through setting up Expression Engine with the FeedGrab plugin to capture data from a magnolia data feed.

Introduction

The FeedGrab plugin allows you to insert the contents of RSS or ATOM feeds into Expression Engine weblogs.

Why?

The FeedGrab plugin, as well as allowing you to keep your own copy of the data in your own database, provides you with the ability to use all of Expression Engine’s nifty weblog features, such as calendar-based archives, the facility to randomly display items, search tools and the option of relating this external data with your own weblogs entries via EE’s related field feature.

With the data stored in a weblog you have the option of displaying the information however you like, either combined with other weblog data or on its own.

Install plugin

Download the latest version of the FeedGrab plugin from here.

To install it, follow ExpressionEngine’s plugin installation instructions

A look at the feed

The RSS feed I will be using is from mag.nolia.com and is a list of my most recently saved bookmarks. From the site I find its URL:

http://ma.gnolia.com/rss/lite/people/ajweaver

Loading this file in the browser and viewing its source shows its structure - the bits I’m interested in is between the <item> tags

    <item>
      <title>Compose to a Vertical Rhythm</title>
      <author>ajweaver</author>
      <description type="html"><p>Leading (line-height) a forgotten element of web typography.</p>
</description>
      <pubDate>2006-12-12T13:41:14-08:00</pubDate>
      <link>http://24ways.org/2006/compose-to-a-vertical-rhythm</link>
      <guid>http://ma.gnolia.com/people/ajweaver/bookmarks/mijolisc</guid>
      <category domain="http://ma.gnolia.com/tags">typography</category>
    </item>

For the purpose of this tutorial I want the title, description and link.

Create a new weblog

Before creating the weblog I usually set up the custom fields

Create a new weblog field group and add 2 new fields for description (make it a textarea) and link (a text input). I’ll call these magnolia_body and magnolia_url (Note, a weblog always has a title field by default so we’ll use that for the title field)

Create a weblog called magnolia and assign the custom fields group to it.

Tip: Edit the preferences for this weblog ( Weblog Administration >  Weblog Management > Edit Preferences) and in Weblog Posting Preferences set Automatically turn URLs and email addresses into links? to No.

From the Weblog Management page make a note of the weblog’s id.

Create template

We’ll create a template to view the results (you might want to manually enter some test data to check this).

Create a new template group. It should have an index template automatically into which add:

{exp:weblog:entries
    weblog="events" orderby="date"
    limit="10" show_future_entries="yes"}

<h4><a href="{magnolia_url}">{title}</a></h4>
<p>{magnolia_body}</p>

{/exp:weblog:entries} 

Set up plugin

Create another template called go and add the call the plugin:

{exp:feedgrab url="http://ma.gnolia.com/rss/lite/people/ajweaver" 
                          weblog="WEBLOG_ID" 
                          title="title"
                          date="pubDate"
                          use="link|description" 
                          fields="magnolia_url|magnolia_body" }

Replace WEBLOG_ID with the value you made a note of earlier.

The title=“title” line tells the plugin to use the feed’s title as the weblog entry’s title, and date=“pubDate” tells it to use the feed’s pubDate field as the weblog entry’s publish date.

The use=“link|description”  fields=“magnolia_url|magnolia_body”  section tells the plugin to put link into magnolia_url and description into magnolia_body.

To call the plugin, simply go to http://www.yoursite.com/index.php/feedgrab/go

This should add all the new RSS entries into your new weblog. Subsequent calls will only add new entries.

 

Comments

1. George
13th Mar 2007 at 10:42 am

A great plugin and a really good tutorial

2. .(JavaScript must be enabled to view this email address)
24th Mar 2007 at 11:39 am

Hallo!
Your site is really good,
Keep it on, thanx!

3. shaz
10th Apr 2007 at 3:42 am

i realize this is more than a year old, but I was trying to use it and I’m having a few small issues, just thought I’d check to see if you were offering support by any chance. thanks.

4. Andrew
10th Apr 2007 at 7:51 am

Hi shaz,

The plugin is still being (fairly) actively supported (hopefully a new version will be out soon).

The best place for support is probably the ExpressionEngine forum thread: http://www.expressionengine.com/forums/viewthread/37598/

Other people may be able to help there too, if I’m not around.

Andrew

5. shaz
10th Apr 2007 at 10:12 pm

thanks! I’ll check there.

6. Bill
7th Feb 2008 at 3:11 am

Great tutorial! Along with another great comment!

7. Ikariam
20th Mar 2008 at 5:27 pm

That made it so easy :D Thanks!

8. Alexander
26th Sep 2008 at 2:32 pm

Thank for this plugin. Also link to demo page will be appreciated :-)

9. .(JavaScript must be enabled to view this email address)
2nd Oct 2008 at 3:27 am

Does this plugin allow you to set the status to “open”? - Thanks

10. .(JavaScript must be enabled to view this email address)
8th Apr 2009 at 5:13 am

This is not clear at all. You say things like, “Create a new weblog field group and add 2 new fields for description (make it a textarea) and link (a text input).” You need to give the steps.

1. Click X.
2. Click Y.
3. Type Z in the second box, etc.

Your instructions assume that the reader already knows how the admin tools work and understands all these special EE terms. I am an experienced programmer but certainly don’t understand these things.

11. GD
17th Apr 2009 at 9:16 pm

Great plugin for people who have websites powered by EE.

12. Matt
6th Jul 2009 at 11:00 pm

I’m having trouble getting the plugin to do more than Check the feed. It’s not grabbing the content, even though the parameters are set correctly.

13. .(JavaScript must be enabled to view this email address)
31st Jul 2009 at 8:18 pm

I just wanted to drop a comment and thank you for having this plugin made available.  You saved me hours upon hours of time importing entries from a Blogger account into ExpressionEngine.  Thank you.

Commenting is not available in this weblog entry.

© brandnewbox.co.uk 2004-2010