RSS Genesis Project
RSS Genesis? RSS Genesis is an open source project. Written in PHP - http://www.php.net/ - with OOP features, this project can help you to easily generate RSS Feeds.

PHP 4 and PHP 5 compatibility, grants RSS Genesis a stable support to any hosts configuration you have.

This version (1.1) supports RSS 0.91 and partly supports RSS 2.0. We hope to add other specifications support soon. People interested in help the project are welcome! Translators, developers, could help us on this task. Every help will be appreciated. If you want to join us and help, browse to this page: http://rssgenesis.sourceforge.net/help/

/\/\/\
What is RSS? RSS (Really Simple Syndication or Rich Site Summary), is a technology originated from XML. With RSS you can feed news directly from your website to other services or still, directly to your guests desktop!

Thanks to the extensibility extended from XML concepts, RSS has a good and standard definition.

With RSS, anyone can know the last news, using software called nowadays as "Desktop Readers". You will a see a lot about RSS in the future.

» Want to know more about RSS?

/\/\/\
Change Logs?
RSS Genesis 1.1 (this one) @ 01/25/2006
  • Partial support for RSS 2.0
  • Added parameter when creating RSSGenesis class to specify RSS specification to be used
  • Optional channel element in RSS 2.0: category, added.
  • Optional item element: pubDate, added.
  • Optional item element: category, added.
  • Modified RSS output to use tabs instead of spaces.
RSS Genesis 1.0.1 @ 12/14/2004
  • Complete RSS 0.91 Specification support added.
  • Optional channel element: copyright, added.
  • Optional channel element: managingEditor, added.
  • Optional channel element: rating, added.
  • Optional channel element: pubDate, added.
  • Optional channel element: skipDays, added.
  • Optional channel element: skipHours, added.
  • Empty values now can be set as null, in function arguments. Note
  • Auto generated values, now, must be set to "auto", to auto generation effects. Note
  • Empty channels elements are removed from the final RSS feed results.
  • Success message removed, now, the generated RSS feed is displayed instead.
  • Documentation updated.
  • CSS to print added to documentation.
/\/\/\
How I install this? Install? Who said you need to? You don't need to install anything. =)

Just upload to your server the file: rss.genesis.php... Already? Well, it's ready to use then!

/\/\/\
How this thing works? Well, this is the main section of this documentation, then, read it carefully.

Have you already seen a RSS feed? Well, let's see an example: <?xml version="1.0"?>
<rss version="2.0">
    <channel>
        <title>RSS Feed - RSS Genesis 1.1</title>
        <link>http://rssgenesis.sourceforge.net/</link>
        <description>A basic and simple RSS Feed!</description>
        <language>en-us</language>
        <pubDate>Sat, 25 Feb 2006 14:32:59 -0500</pubDate>
        <lastBuildDate>Sat, 25 Feb 2006 14:32:59 -0500</lastBuildDate>
        <category>Test</category>
        <generator>RSS Genesis 1.1</generator>
        <docs>http://rssgenesis.sourceforge.net/links/</docs>

        <image>
            <title>RSS Genesis 1.1</title>
            <url>http://rssgenesis.sourceforge.net/</url>
            <link>http://rssgenesis.sourceforge.net/</link>
            <width></width>
            <height></height>
            <description>Powered by: RSS Genesis!</description>
        </image>

        <textinput>
            <title>Go!</title>
            <description>Search:</description>
            <name>q</name>
            <link>http://www.google.com/search</link>
            </textinput>

        <item>
            <title>First Link</title>
            <link>http://www.google.com/</link>
            <description>First description...</description>
            <pubDate>Sun, 01 Jan 2006 05:00:00 GMT</pubDate>
            <category>Test</category>
        </item>

        <item>
            <title>Second Link</title>
            <link>http://www.php.net/</link>
            <description>Second description...</description>
            <pubDate>Tue, 14 Feb 2006 05:00:00 GMT</pubDate>
            <category>Test</category>
        </item>

        <item>
            <title>Third Link</title>
            <link>http://rssgenesis.sourceforge.net/</link>
            <description>Third description...</description>
            <pubDate>Sat, 25 Mar 2006 05:00:00 GMT</pubDate>
            <category>Test</category>
        </item>

    </channel>
</rss> 
The highlighted elements are the "variables parts". Those items that differ one feed from other.

Now, let's see the PHP coding needed to generate this feed - example.php: <?php

  // INCLUDE
  require ("rss.genesis.php");
 
  // STARTS
  if ($_GET['rssversion']) {
        $rss = new rssGenesis($_GET['rssversion']);
  }
  else
  {
        $rss = new rssGenesis();
  }
 
  // CHANNEL
  $rss->setChannel (
                                  null, // Title
                                  null, // Link
                                  null, // Description
                                  null, // Language
                                  null, // Copyright
                                  null, // Managing Editor
                                  null, // WebMaster
                                  null, // Rating
                                  "auto", // PubDate
                                  "auto", // Last Build Date
                                  "Test", // Category
                                  null, // Docs
                                  null, // Time to Live
                                  null, // Skip Days
                                  null // Skip Hours
                                );
                               
  // IMAGE
  $rss->setImage (
                               null, // Title
                               null, // Source
                               null, // Link
                               "auto", // Width
                               "auto", // Height
                               null // Description
                             );
 
  // ITEM
  $rss->addItem (
                             "First Link", // Title
                             "http://www.google.com/", // Link
                             "First description...", // Description
                             "01/01/2006", //Publication Date
                             "Test" // Category                            
                           );
 
  // ITEM
  $rss->addItem (
                             "Second Link", // Title
                             "http://www.php.net/", // Link
                             "Second description...", // Description
                             "02/14/2006", //Publication Date
                             "Test" // Category                
                           );
 
  // ITEM
  $rss->addItem (
                             "Third Link", // Title
                             "http://rssgenesis.sourceforge.net/", // Link
                             "Third description...", // Description
                             "03/25/2006", //Publication Date
                             "Test" // Category                
                           );
 
  // INPUT
  $rss->setInput (
                             null, // Title
                             null, // Description
                             null, // Name
                             null // Link
                           );
 
  // FINISH
  $rss->createFile ("my.rss");

?> 
Note about "auto" values: Since from RSS Genesis first release, the auto-generation values (to some itens only), was present. But, in the RSS Genesis 1.0.1 or newer, to use this feature you must set the value to "auto", not just leave empty it. See below, which itens can be set to "auto".

Note about "null" values: Null values are equals to empty values. This option was added to create a better visual conception.

When calling the script by itself, the resulting feed will follow the RSS 2.0 specification. Alternatively, to request a feed that follows the RSS 0.91 specification, example.php should be called with the argument ?rssversion=RSS091 (e.g. www.test.com/example.php?rssversion=RSS091).

Of course, calling the class methods like is displayed above, results in a feed with the defaults values inside. You don't want this, right? Let's study all the methods. All methods names are pretty descriptive. Probably you will understand what the methods do, just reading their name. The parameters will be explained.

rssGenesis ($rssversion);

$rssversion: The version of the specification to follow to produce the RSS feed file. Values for this parameter should RSS091 or RSS20. The default value if nothing is specified is RSS20.


setChannel ($title, $link, $description, $language, $copyright, $managingEditor, $webMaster, $rating, $pubDate, $lastBuildDate, $category, $docs, $skipDays, $skipHours);

$title: The name of the feed.

$link: An absolute URI to your site.

$description: Here you can describe your site. Don't use HTML.

$language: Feed native language. Contracted form.

$copyright: (RSS Genesis 1.0.1 +) Copyright declaration, if applicable.

$managingEditor: (RSS Genesis 1.0.1 +) News managing editor (email).

$webMaster: Webmaster (email).

$rating: (RSS Genesis 1.0.1 +) Feed rating.

$pubDate: (RSS Genesis 1.0.1 +) Publication date. RFC 2822 format. Using the "auto" value, forces RSS Genesis to auto-generate this item value.

$lastBuildDate: Last modification in feed registered. RFC 2822 format. Using the "auto" value, forces RSS Genesis to auto-generate this item value

$category(RSS Genesis 1.1 +) Feed category.

$docs: RSS documentation help (URI). Using the "auto" value, the URI will be: http://rssgenesis.sourceforge.net/links/.

$skipDays: (RSS Genesis 1.0.1 +) Feed skipped days. Valid days: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday. To skip multiple days, use a separator, to separate each day: "|" (Forget the quotes...)

$skipHours: (RSS Genesis 1.0.1 +) Feed skipped hours. Valid hours: 1 <= hour <= 24. To skip multiple hours, use a separator, to separate each hour: "|" (Forget the quotes...)

This method must be called one time. If you call it two or more times, only the last data given will be displayed.
setImage ($title, $src, $link, $width, $height, $description);

$title: Image title. Used as ALT attribute from IMG tags.

$src: Image source. Absolutes URIs only!.

$link: URI that will be linked by image.

$width: Image width. Using the "auto" value, forces RSS Genesis to auto-generate this item value.

$height: Image height. Using the "auto" value, forces RSS Genesis to auto-generate this item value.

$description: Some description about the image or else, about your site too.

This method must be called one time. If you call it two or more times, only the last data given will be displayed.
setInput ($title, $description, $name, $link);

$title: Label to submit button.

$description: Here you can describe what this form does. =)

$name: Name associated to the input text to be interpreted by a scripting language.

$link: Absolute URI that indicates where data must be send.

This method must be called one time. If you call it two or more times, only the last data given will be displayed.
addItem ($title, $link, $description, $pubDate, $category);

$title: News title.

$link: Absolute URI to news full version.

$description: A synopsis of the news. Must make the reader curious. =)

$pubDate(RSS Genesis 1.1 +) Publication date of a particular item. RFC 2822 format. Using the "auto" value, forces RSS Genesis to auto-generate this item value.

$category(RSS Genesis 1.1 +) Item category.

This method can be called how many times you want (maximum 15 times). Items are the main section in your feed.
Simple Methods - Not useless!!!
createFile ($name);

$name: Feed file-name. Relative URIs! Don't forget the extension!

This method must be last one called.
organizeData (void);

You don't need to call this one.

/\/\/\
Error Codes Guide? Here you have an reference to each error code, that RSS Genesis can report to you.

Notice: PHP parsing errors, will occur if you create a not-well-formed PHP document. It's not required, but certainly helps, that you have some knowledge about PHP syntax.

You can easily recognize a error generated by RSS Genesis, because their errors have a standard format. It's always preceded by "Error code" and a number, followed by a short description about the error and, at the end, there is a link to online documentation help.

Element title from item node is mandatory. Probably you left it empty or have defined it as null. Add some value on it, to "fix" this one. Element link from item node is mandatory. Probably you left it empty or have defined it as null. Add some value on it, to "fix" this one.
/\/\/\
Latest Version? The latest version always can be found at: http://sourceforge.net/projects/rssgenesis/

/\/\/\
Is this thing free? Yes. RSS Genesis is under the LGPL. Read it to understand: http://rssgenesis.sourceforge.net/docs/LGPL

/\/\/\
I want to help!!! Serious? We appreciate every help! Browse to this page: http://rssgenesis.sourceforge.net/help/

/\/\/\
I've found a bug!!! Could you, please, report it here:

http://sourceforge.net/tracker/?func=add&group_id=125371&atid=702238?

Thank you!

/\/\/\
Credits - Thanks! In first place, we would like to say thanks to you, which are reading this; even we don't know where you are, or who you are. =)

People directly involved with this project (until this version release date): View every people that contributed to RSS Genesis.

We hope RSS Genesis help you. Have a nice day!
/\/\/\

RSS Genesis 1.1 :: Generated: Saturday February 25th, 2006

English version by: Klaus Roberto de Paiva
Updated by: Yannick Lefebvre