Wednesday, January 20, 2010

RSS feed with Seaside

Add a RSS feed to Pharocasts Seaside Blog! Furthermore, you will learn how to search for a package on Squeaksource and load it into your Pharo image using Gofer.

Download screencast (800x600): .mpeg, 12.1 MB, .mov, 25.8 MB



Load the source code:
Gofer new
    squeaksource: 'rsrss';
    package: 'RSRSS2';
    squeaksource: 'Pharocasts';
    package: 'RSSFeedWithSeaside';
    load.

Code samples.

Define your RSS component:
RRComponent subclass: #BlogRSSFeed
 instanceVariableNames: ''
 classVariableNames: ''
 poolDictionaries: ''
 category: 'RSSFeedWithSeaside'

Populate your feed:
renderContentOn: rss
 rss title: 'Tips & Tricks posts'.
 rss description: 'Feed to Tips & Tricks blog, famous blog about Smalltalk'.
 rss url: 'http://localhost:8080/seaside/blog.rss'.
 
 Post database reverse do: [:aPost|
  rss item: [
   rss title: aPost title.
   rss description: aPost body.
   rss publicationDate: aPost publishedAt.
  ]
 ].

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.