Improving validation for snews rss feeds (1)

March 22, 2010 at 16:01 Leave a comment

While checking the validation for snews rss feeds, I came up against some problems and found some fixes, which may help others who have similar proplems. The first problems I encountered was the the w3c rss validator told me that in the link tag the rel=self was missing. This is easily fixed by adding the following lines to the rss_contents() in snews.php

find:
echo '
<?xml version="1.0" encoding="'.s('charset').'"?>
<rss version="2.0">
<channel>
<title><![CDATA['.s('website_title').']]></title>
<description><![CDATA['.$heading.']]></description>
<link>'._SITE.'</link>

and replace with:
if (substr($rss_item,-1) != '/') {
  $rss_item_link = $rss_item . '/';
} else {
  $rss_item_link = $rss_item;
}
echo '
<?xml version="1.0" encoding="'.s('charset').'"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"&gt;
<channel>
<title><![CDATA['.s('website_title').']]></title>
<description><![CDATA['.$heading.']]></description>
<link>'._SITE.'</link>
<atom:link href="'._SITE.$rss_item_link.'" rel="self" type="application/rss+xml" />

This will make the feed Atom compliant, which seems to be necessarry for the w3c Validator.

Advertisements

Entry filed under: snews CMS. Tags: , , .

Festival of World Cultures Improving validation for snews rss feeds (2)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


March 2010
M T W T F S S
« Aug    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other followers


%d bloggers like this: