The Discussion

You really need to read "RSS feed creation - Discussion and Solution". It is a very long thread that covers RSS feed creation in detail. This document is based on that thread and on "RSS and 1.31.5" in the Coranto Support Forum.

RSS Addons

There are three RSS addons for Coranto.

RSS File (Beta Build 4) was written by Elvii, Coranto's original author. It is outdated and does not build valid RSS 2.0 feeds.

Feed Builder by Dale Ray builds valid RSS 2.0 feeds and is based on RSS File by elvii. Feed Builder works with Coranto V 1.24 and V 1.25, but does not work with the V 1.31.x series (current beta Coranto versions)

RSS Files Advanced by cerberos76. This addon is discussed in this thread. This addon is not available publicly at the time of this writing because the author does not allow redistribution and does not have a download site available.

Using an addon makes the process of creating a feed simpler, but is not required to successfully create feeds.

↑ Contents

Coranto 1.31.x - Style, Profile, Template

This solution is from Musicvid and is discussed in this forum thread. This section is from that thread and credit should go to Musicvid unless noted.

Features

  • Creates valid RSS 2.0 (http://feedvalidator.org)
  • Uses strftime for dates, which is very fast and fully RFC822 compliant (There is an alternative included if for some reason Posix isn't on your server)
  • Puts all the variables in the style rather than hardcoding the template. This way, one template will serve many feeds.
  • Puts text between <![CDATA[]]> blocks to escape illegal characters like ' " & < >

The Style

<PerlCode>

   # Just run the channel stuff once
   my $i  = ++$countitems{$ProfileName};
   for ($i)
   {
   next unless $i eq "1";

   ## Populate Channel Fields ##
   ######################################
   #  CHANGE TO MATCH YOUR INFORMATION  #
   ######################################

   # Your Organization or Feed Name
   my $orgname    = 'Your Organization Name';

   # Optional Acronym or Abbreviation (can leave blank)
   my $orgabbr    = '';

   # Channel Image Must Be No More Than 144px In Width
   my $imageurl   = 'http://yoursite.com/yourlogo.gif';

   ######################################
   #   ANY CHANGES BELOW ARE OPTIONAL   #
   ######################################

   if (!$orgabbr) {$orgabbr = $orgname;}
   my $SiteTitle  = $CConfig{'SiteTitle'};
   my $SiteLink   = $CConfig{'SiteLink'};

   # Gets the current time in RFC822 format
   use POSIX qw(strftime);
   # If Posix isn't on your server, comment it out and uncomment the line below.
   # use Date::Format;
   my @BuildDate = localtime(time);
   my $now_year = strftime("%Y", @BuildDate);
   my $BuildDate = strftime("%a, %d %b %Y %H:%M:%S %z", @BuildDate);
   # If a US timezone, could use %Z above instead

   # Added to confirm feed build in 'News Built' dialog
   print "<small>\"$ProfileName\" Feed Built: $BuildDate<br></small>";

$newshtml .= "<title><![CDATA[<Field: orgabbr> News]]></title>\n";
$newshtml .= "<link><Field: SiteLink></link>\n";
$newshtml .= "<description><![CDATA[The Latest News from <Field: orgname>]]></description>\n";
# Could use <Field: SiteTitle> in description instead
$newshtml .= "<copyright><![CDATA[Copyright (c) <Field: now_year> <Field: orgname>.
 All rights reserved.]]></copyright>\n";
$newshtml .= "<language>en-us</language>\n";
$newshtml .= "<lastBuildDate><Field: BuildDate></lastBuildDate>\n";
$newshtml .= "<image>\n";
$newshtml .= "<title><![CDATA[<Field: orgabbr> Home Page]]></title>\n";
$newshtml .= "<link><Field: SiteLink></link>\n";
$newshtml .= "<url><Field: imageurl></url>\n";
$newshtml .= "</image>\n";
   }

   ## Populate Item Fields ##
   my @time_added = gmtime($newstime);
   my $pubDate    = strftime("%a, %d %b %Y %H:%M:%S GMT", @time_added);
   my $adminurl = $scripturl;
   $adminurl =~ s/\/coranto.cgi?/\//;
   # Template for item links (can leave blank)
   my $tmpl    = 'viewnews';

   # Added to fix undeclared curly quotes (MS Word)
   $Subject =~ s/[‘’]/'/g;
   $Subject =~ s/[“”]/"/g;
   $Text =~ s/[‘’]/'/g;
   $Text =~ s/[“”]/"/g;

## RSS NOTES
#  Channel Image Must Be <= 144px In Width
#  No HTML in <title> Fields
#  Keep Fields Containing ' " & < > \ between <![CDATA[]]> tags
#  Avoid using HTML entities such as &quot;
##
</PerlCode>

<item>
<title><![CDATA[<Field: Subject>]]></title>
<link><![CDATA[<Field: adminurl>viewnews.cgi?id=<Field: newsid>&style=&tmpl=<Field: tmpl>]]></link>
<description><![CDATA[<Snip 265: Field: Text>]]></description>
<pubDate><Field: pubDate></pubDate>
<guid isPermaLink="false"><Field: adminurl>viewnews.cgi?id=<Field: newsid></guid>
</item>

↑ Contents

The Template

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
<channel>
<Field: Content>
</channel>
</rss>

Full Install Instructions

1) In Coranto 1.31.5 Beta, go to Administration->Edit News Styles->Create New Style.

2) Name the new Style "RSS Feed" without the quotes and create a STANDARD Style.

3) Click "Edit" RSS Feed and paste the Style Code I provided. Type in the name of your Organization or Feed, and the URL of your Channel Image, which can be no more than 144 pixels in width. Click "Save Changes."

4) Open the Notepad application on your computer, paste the Template code I provided, Save the file, then Rename the file to "rss.tmpl" without the quotes. Upload the rss.tmpl file to the "Templates" folder in your Coranto 1.31.5 installation on your server.

5) In Administration->Manage Profiles->Create New Profile, create a Profile named "RSS_Feed" without the quotes. Enable the RSS_Feed Profile.

6) Click "Edit General Settings" for the RSS_Feed Profile. Scroll down to "Categories" and select any Categories of news items you wish to include in your feed. Immediately below that, select "RSS Feed" as your News Style. Scroll down to "HTML Template" and select "rss.tmpl". Immediately below that, type in "rss.xml" without the quotes as your "HTML User File Name." Scroll down to "Anchor Tags?" and set them to "OFF." Do not make any other changes to the Profile settings. Click "Save Changes."

7) Go to Administration and click the "Build News" link. You should now have a valid RSS 2.0 file named "rss.xml" in your news files folder.

Notes

There is additional discussion in the forum thread.

↑ Contents

Another Solution

Another approach is this one:

Alternate style

<item>
  <title><Field: Subject></title>
  <link>http://t3/coranto/viewnews.cgi?id=<Field: newsid></link>
  <description><WordSnip Field: Text></description>
  <pubDate><Field: Date></pubDate>
</item>

The <WordSnip> tag requires the Snipper addon by Parahead.

Alternate Template

<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="rss.css" ?>
<rss version="2.0">
<channel>
<title>Test RSS Feed</title>
<link>http://www.corantodemo.org</link>
<description>Test of an RSS feed generated by Coranto.</description>
<language>en-us</language>
<Field: Content>
</channel>
</rss>

Date Format

Set Coranto's date format to:

<Field: Abbrev_Weekday>, <Field: TwoDigitDay> <Field: Abbrev_Month_Name> <Field: Year> <Field: TwoDigitHour>:<Field: Minute>:<Field: Second> CST

Where the CST is replaced by the correct time zone abbreviation. Some of these date fields are not available in Coranto 1.24. This is just about the simplest feed you can build.

Be sure to set the extension for the file created by the profile to be xml.

You can actually build an RSS feed with no addons if you use Coranto's built in snip feature to snip the text. ↑ Contents

Coranto v 1.24 and 1.25

The current stable version of Coranto does not allow for specifying the file extension for files created on a per profile basis. You can adapt the methods above to the current versions and get the correct file extension by setting the Archive HTML File Extension setting on the main Coranto settings page to xml. This will cause all profiles to build files ending in xml.

Post–Build File Renamer/Mover

This is an addon that adds the ability to rename and/or move the files created with the current stable version of Coranto on a per profile basis.

There are three new settings for each profile. One for the name, another for the extension, and a third for a destination path. If you leave these blank Coranto's behavior will not change. Entering a value into these will cause the file created by the build process to be renamed or moved.

This addon uses perl's built-in rename command. This is implemented in different ways in different platforms.

Disclaimer

The author of this article - Dale Ray - is also the author of two of the addons discussed in the article.

  • Feed Builder
  • Post–Build File Renamer/Mover

↑ Contents

Categories:




Page last modified on February 02, 2009, at 07:29 PM