Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Following the RSS Feeds Tutorial (http://docs.couchcms.com/concepts/rss-feeds.html), I am trying to create a feed for blog listing.

So I create rss.phh with the following code and placed it in the root folder, i.e. it should be available on "http://example.com/rss.php":

Code: Select all
<?php require_once( 'cmsadmin/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />
<rss version="2.0">

<channel>
  <title>Blog RSS Feed</title>
  <link>http://example.com/blog/</link>
  <description>Blog Posts</description>
  <language>en-us</language>

  <cms:pages masterpage='blog.php' limit='10'>
  <item>
    <title><cms:show k_page_title /></title>
    <link><cms:show k_page_link /></link>
    <description><cms:excerptHTML count='50' ignore='img'><cms:show blog_content /></cms:excerptHTML></description>
    <pubDate><cms:date k_page_date /></pubDate>
  </item>
  </cms:pages>

</channel>

</rss>
<?php COUCH::invoke(); ?>


Now the problem is when I visit the stream in the browser, the page gets redirected to the login screen:

http://example.com/cmsadmin/login.php?r ... %2Frss.php

Any idea what could be wrong?

Is it possible that some variable names changed in config.php since the tutorial was written (i.e. k_site_charset vs K_CHARSET)?
Seems like your RSS template is not registered with Couch yet (its name should appear in the admin-panel sidebar if it is).

Enter your super-admin creds in the login box and that should get the template registered.
You shouldn't get the login box after this. In case you do, please check that access to this template has been set to 'Everybody' (from the 'Advanced settings' dropdown of its edit page).

Hope it helps.
Thanks for your quick reply.

It appears in the backend as rss.php, access it set to everybody and it is published,
but when you visit the page on http://example.com/rss.php it redirects to http://example.com/rss/ and throws a 404 error.

Any idea?
Are you sure you regenerated your site's .htaccess file (using gen_htaccess.php) after adding the rss.php template? Please check the .htaccess file to verify that it has an entry for this template.
Thanks, KK. That was the issue.

Is there a way to transform the <cms:excerptHTML> output into clear text, which is used to truncate the description?

XML is mumbling about the <p> tags for the description, but using the ignore-option will
clear everything, i.e. leave the field blank.
How about using <cms:excerpt> instead?
http://docs.couchcms.com/tags-reference/excerpt.html
That worked. Thanks a lot :)
7 posts Page 1 of 1