DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: RSS Newsfeed Export

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2005-02-02T17:13:42
Author:Michael Keukert
Email:pmk@naklar.de
Info 3:
Info 4:

EXT: RSS Newsfeed Export

Extension Key: pmk_rssnewsexport

Copyright 2000-2002, Michael Keukert, <pmk@naklar.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: My Extension 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 2

FAQ 3

Configuration 3

Reference 3

Known problems 4

To-Do list 4

Changelog 4

Important guidelines 5

Issues with Open Office documentation for TYPO3 5

Inserting images 5

Paragraph styles 5

Linking 6

Meta data and updates 6

Introduction

Fostered by the popularity of the BLOG-community, syndication of content has become a major issue. No major player, be it wired.com, slashdot.com, zdnet.com, the leading German computer magazine publisher heise.de or leading newspapers like nytimes.com, usatoday.com or the German weekly magazine spiegel.de dares to NOT offer content syndication. Thousands of smaller sites profit from this syndication, since they can inlcude content from “the big guys” in a perfectly legal way, and thus boost their own content while the original syndicator gets the credit for it. A win-win situation.

Recently, a new trend started to evolve. Web-citizens, tired of spam- ridden email and of pseudo-newsletters they have never subscribed to or can't unsubscribe from, are switching to actively request information while avoiding newsletters and email-contacts. The mature and experienced web-visitors expects that webmasters provide this information in a no-nonsense, straightforward way. Especially commercial webmasters would better provide this information.

The tool used in both scenarioes is the same: a standardized content- feed in an XML-format known as RSS.

The abbreviation stands for “Rich Site Summary” or “Real Simple Syndication” or “RDF Site Summary” - regarding who is talking to you. This acronym confusion shows already that the story behind RSS is not as simple as it seems. The main problem is that there are conflicting standards, developed and promoted by two different organizations. I don't intend to go into this right now. A very good comparison and historic documentation can be found here http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html

What does it do?

This extension for Typo3 3.5 or higher exports tt_news (< version 2.x) newsitems into RSS feeds. The user has the choice of RSS 0.91 or RSS 2.0 newsfeeds. RSS 0.91 is the most widely used format, yet it is upward compatible to RSS 2.0, which is a bit more “liberal” and allows longer field. This extension DOES NOT export RSS 1.0 (aka RDF) feeds! Look for Christoph Möllers cm_rdfexport extension, which was the basis for this extension.

Th RSS newsfeed can be read by any RSS-compliant desktop tool or RSS parsers available in all web programming languages. In its main mode, it inserts a link to the actual RSS newsfeed page for which page type 334 is defined. There are some options to chose from and some variables to define. Most prominently whteher the feed should be protected or not.

Features

  • Exports RSS 0.91 and RSS 2.0 newsfeeds
  • Embeds Auto-aggregation <head> element into the page, so that feed- aggregators and modern browsers automatically detect the feed.
  • Automatically takes care of RSS 0.91 restrictions like maximum number of elemebts and maximum sizes
  • Fully customizeable trough typoscript template (example included)
  • Feeds can be restricted to logged-in frontend users

Screenshots

img-1 Firefox automatically detects feeds (orange icon in the right part of the status bar) and can add “live bookmarks” for the feed (left pane).

img-2 RSS Readers (or aggregators) display the feed in a newspaper- like way.

img-3 XML generated by this extension can be displayed in browser.

img-4 This is how a feed is inserted in the backend as frontend plugin, with an optional checkbox for the protection of the feed:

img-5

Users manual

Install the extension via the EM.

You can then insert a new content element type “RSS Newsfeed Export” on any page:

img-6

Enter a header title and tick the checkbox “Protect external access to this newsfeed?” if you wish it to be protected.

Protection in this case means that

a user needs to be logged in as a valid FE user in order to be presented the URL to the feed

the URL for external access to the raw XML data will contain the user's username and his md5'ed password hash

The URL a user is shown in order to view our XML feed basically looks like this:

  1. non-protected feed:

index.php?id =<id_of_this_page>&type=333&feed_id=<content_element_id>

  1. protected feed:

index.php?id =<id_of_this_page>&type=333&fe ed_id=<content_element_id>&user=<fe_username>&pass=<md5_hash>

An extension template needs to be created on the page the newsfeed resides on to make some adjustments that are necessary in order to get properly formatted RSS link tags etc.

An exemplary template setup should look somewhat like this:

pmk_rssnewsexport >
pmk_rssnewsexport = PAGE
pmk_rssnewsexport {
  typeNum = 334
  config.disableAllHeaderCode = 1
  config.additionalHeaders = Content-type:text/xml
  includeLibs.pmk_rssnewsexport = EXT:pmk_rssnewsexport/pi1/class.tx_pmkrssnewsexport_pi1.php
  10 = USER
  10 {
    userFunc = tx_pmkrssnewsexport_pi1->make_xml

    # title of your newsfeed, maximum 100 chars
    feedTitle = My RSS newsfeed

    # Copyright notice
    feedCopyright = 2004 My Company

    # Who is the person in charge of the newsfeed-content (email address)
    feedManagingEditor = editor@mycompany.com

    #  Who is the technical contact for problems with the newsfeed (email address)
    feedWebMaster = webmaster@mycompany.com

    #  If you don't want the individal author's names appear in the feed, you can override them here
    feedAuthorOverride = info@mycompany.com

    # main URL to include in your newsfeed, maximum 500 chars (just for user information)
    feedLink = http://www.mycompany.com

    # language in which the information is written, optional for RSS 2.0, required for 0.91
    # by default from typoscript variable "config.language" - might be overridden
    # default = en
    feedLanguage < config.language

    # description of your newsfeed, maximum 500 chars
    feedDescription = Great news about ym company

    # image included in the feed, optional for RSS 2.0, required for RSS 0.91
    # feedImage = http://www.mycompany.com/fileadmin/template/images/Logo.gif

    # prefix for direct tt_news item links
    # set up a news details page (code=SINGLE) with an extension template
    # that sets the correct backPID value to a news overview page!
    # (simulateStaticDocuments should be on, since &-signs violate RDF charspace!)
    feedItemLinkPrefix = http://your.domain.tld/newsfeeddetail.html=

    # shorten tt_news short + bodytext to this length in XML item description
    # default=100, maximum 500 in RSS 0.91
    feedItemDescLength = 200

    # select news from these tt_news sysfolders, default=all
    # newsPidList =

    # which news categories to show, default=all
    # newsCatList = 1,2,3,5

    # how many items to show in XML feed, default=all, maximum of 15 for RSS 0.91
    newsItemCount = 5

    # SQL sorting by tt_news field name, default=no ordering
    newsItemOrderBy = crdate DESC

  }

}

Modify this to your situation, save and view the page. This should be it. A reference of the possible TS params is available below.

For testing, use a modern browser that is capable of showing inline XML structures. Mozilla's DOM inspector is a great tool for that purpose.

Otherwise, you could use a desktop RSS reader like f.ex. FeedReader ( www.feedreader.com , for Windows), KNewsTicker (for Unix, included in KDE2+) or MulleNews (www.mulle- kybernetik.com/software/MulleNews/, for MacOS X) to access and examine your own newsfeed.

Frank Becker < fb@alien8.de > provides the following input, which I haven't tested for myself (yet):

Make sure "config.xhtml_cleaning=all" is not set in your TS. Otherwise Typo3 will replace each <link> tag with <link />

FAQ

Q: Why does my RSS feed only show 15 items – I have defined a higher number in the extension template!A: You have selected RSS 0.91 which has a built-in limitation of 15 items. Switch to RSS 2.0 instead.

Q: An ungly “RSS 0.91” graphic is appearing in my newsfeed. How can I get rid of it?A: You have selected RSS 0.91, which demands a feed- graphic. Either provide an nice looking one and give it's address in the template, or switch to RSS 2.0 which does not demand a graphic.

Q: What should I select, RSS 0.91 or RSS 2.0?A: The current standard is 2.0 – and it is more flexible than 0.91 and allows for more elements and longer content. Unless you have a very pressing need to use 0.91 (which I can hardly think of), use 2.0.

Q: I want to install pmk_rssnewsexport and cm_rdfexport on the same page, but there seem to be some strange things happening.A: You are probably using an older version of pmk_rssnewsexport. In version prior 1.1 both extensions used the same pagetype (333) which lead to conflicts. Update to a recent version which uses pagetype 334.

Q: Can I put the aut-aggregate tag on other pages as well, without putting the plugin on each page?A: Yes, but you have to do it manually. Scan the generated HTML for a line starting with <link rel="alternate" type="application/rss+xml" title="RSS_feed_ID_... and put the whole line into the <head> of the additional pages. I probably provide an easier way in one of the next versions.

Configuration

This section refers to the possible TS parameters that can be used to configure this extension.

feedTitle

Property

feedTitle

Data type

string

Description

Sets the title of the newsfeed.

Default

feedDescription

Property

feedDescription

Data type

string

Description

Sets the description of your newsfeed.

Default

feedImage

Property

feedImage

Data type

string

Description

Defines a URI to an optional feed image that is shown in RSS readers.

Default

feedItemLinkPrefix

Property

feedItemLinkPrefix

Data type

string

Description

Sets the link prefix for each tt_news item in the feed.

This looks like this in XML/RSS:

<link>feedItemLinkPrefix<tt_news_item_id></link>

Default

feedItemDescLength

Property

feedItemDescLength

Data type

Int+

Description

Sets the maximum length of the <description> field that contains the beginning of the tt_news item's bodytext. Value is given in chars.

Default

100

feedCopyright

Property

feedCopyright

Data type

string

Description

Copyright information of your feed

Default

feedManagingEditor

Property

feedManagingEditor

Data type

string

Description

The person in cahrge of your feed (email address)

Default

feedWebmaster

Property

feedWebmaster

Data type

string

Description

The technical contact for the feed (email address)

Default

feedLanguage

Property

feedLanguage

Data type

string

Description

Language of the feed (required for 0.91)

Default

en

newsPidList

Property

newsPidList

Data type

Int+

Description

List of sysfolder PIDs that are supposed to be used for tt_news item fetching. Default behaviour: fetch from all tt_news sysfolders.

Default

newsCatList

Property

newsCatList

Data type

Int+

Description

List of tt_news category uid's that are supposed to be used for tt_news item fetching. Default behaviour: fetch from all tt_news categories.

Default

newsItemCount

Property

newsItemCount

Data type

Int+

Description

Sets how many tt_news items shall be included in the RSS feed. If not given, all items are included. Maximum 15 items in RSS 0.91

Default

newsItemOrderBy

Property

newsItemOrderBy

Data type

string

Description

If property is set, the SQL result ordering of the news items can be influenced. All columns of the tt_news table can be used for odering.

Syntax:

[crit1] [crit2] [crit3] ... [DESC] | [ASC]

Example:

newsItemOrderBy = crdate uid DESC

Default

[tsref:plugin.tx_pmkrssnewsexport]

Known problems

Although this extension delivers properly formatted RSS feeds, there is currently one limitation:

Links to any news items (each tt_news item has a direct link like index.php?id=123&backPID=321&tt_news=44) contain “&” signs that are not allowed in the RSS “link” field. As a matter of fact, you need a way to get RSS viewers to be able to open a direct link in a browser that points to the actual tt_news item in the feed. But you can't use the &tt_news=... GET variable in the TS param “feedItemLinkPrefix”...

A possible workaround is to use simulateStaticDocuments and set up a .htaccess for mod_rewrite in your T3 root that rewrites URLs to a news page, which is then accessible as something “newsfeeddetail.html”.

Put a line like this in your .htaccess to enable address rewriting:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule   ^[^/]*\.html$  index.php

So, set up a page that is being used to display single news (code=SINGLE), with an alias of “newsfeeddetail”.

Then, set up an extension template on the newsfeed details page that contains a way to transfer the backPID variable to the links in the news plugin on this page.

Put this into the TS constants of the newly created news detail page:

plugin.tt_news {
  backPid = 34
}

And, don't forget to adapt the TS value “feedItemLinkPrefix” in the RSS template to something like:

feedItemLinkPrefix = http://your.domain.tld/newsfeeddetail.html?tt_news=

This way, when someone clicks on the item in his RSS reader to open the item's link, mod_rewrite will transfer to the correct tt_news PHP page.

To-Do list

  • Better way of linking to tt_news items
  • Wrapping images in newsitems into <enclosure> elements of RSS 2.0
  • Getting the feed to validate (mostly character encoding issues)
  • Finding a way to generate plaintext-URL's (instead of the parameter passing) with XML-ending
  • Providing functionality to embed auto-aggregate tag on pages without the plugin

Changelog

  • 0.0.0.: initial version based on cm_rdfexport
  • 0.0.1.: first non-public version for testing only
  • 0.0.2.: second version with minor bugfixes, non-public
  • 0.0.3.: first public beta. Should work as intended.
  • 0.0.4.: <docs> section according to selected RSS version. If only teaser(short) text on tt_news exist, an empty <description> was given – fixed.
  • 0.0.5.: Finnish translation :-) Version was more or less generated by error :-)
  • 0.1.0.: Taken care of most of the character encoding. Auto-aggregation code is inserted into the <head> element if the feed is public.
  • 0.1.1.: Page type changed from 333 to 334 in order to avoid conflicts with the extension cm_rdfexport.
  • 0.1.2.: Version generated by error (I'm still a bit confused with the publishing settings in the TER...)
  • 0.1.3.: Norwegian translation
  • 0.1.4.: Override option for the individual news item author names in favour of a global name

img-7 EXT: RSS Newsfeed Export - 7