ExpressionEngine FeedGrab plugin tutorial
Thursday, December 14th, 2006
Category: ExpressionEngine, Add-ons, FeedGrab
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
Commenting is not available in this weblog entry.Related articles
- EE2.0 progress report
- Testers required for new Quiz module
- Support forums now available
- ExpressionEngine 2.0 and add-ons
- Featured on ExpressionEngine Techniques screencasts
- Selected items 1.4 released
Most recent articles
- EE2.0 progress report
- Testers required for new Quiz module
- Support forums now available
- ExpressionEngine 2.0 and add-ons
- Featured on ExpressionEngine Techniques screencasts
1. George
13th Mar 2007 at 10:42 am