Dynamic Web Development with Seaside

19.3Rendering News Items

Finally, we want to render the todo items. Each news item is enclosed within a item tag. We will display the title and show the due date as part of the description. Also we prepend the string (done), if the item has been completed.

ToDoRssFeed>>renderContentOn: rss
self renderChannelOn: rss.
self model items
do: [ :each | self renderItem: each on: rss ]
ToDoRssFeed>>renderItem: aToDoItem on: rss
rss item: [
rss title: aToDoItem title.
rss description: [
aToDoItem done
ifTrue: [ rss text: '(done) ' ].
rss render: aToDoItem due ] ]

Doing so will generate the required XML structure for the item tag.

    <description>(done) 5 March 2008</description>

At the minimum, a title or a description must be present. All the other sub-elements are optional.

RSS Tag Selector Description
title title The title of the item.
link link The URL of the item.
description description Phrase or sentence describing the channel.
author author The item synopsis.
category category Includes the item in one or more categories.
comments comments URL of a page for comments relating to the item.
enclosure enclosure Describes a media object that is attached to the item.
guid guid A string that uniquely identifies the item.
pubDate pubDate Indicates when the item was published.
source source The RSS channel that the item came from.

Copyright © 21 April 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.