RSS not pulling in any info

7 posts by 3 authors in: Forums > CMS Builder
Last Post: June 18, 2009   (RSS)

By isdoo - June 17, 2009

Hi,

I have followed the guidance in the manual for RSS, which seems fairly straight forward.

However I am not pulling any info into the xml page.

it appears to stop at my site name withing Firefox and doesn't display anything in IE.

My code is....

<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php
require_once "/full/path/to/httpdocs/cms/lib/viewer_functions.php";

list($news1Records, $news1MetaData) = getRecords(array(
'tableName' => 'news1',
'limit' => '15',
));

?>
<rss version="2.0">
<channel>
<title>mydomain.Com</title>
<link>http://www.mydomain.com</link>
<description>my description for the site</description>
<pubDate><?php echo date('r'); ?></pubDate>
<language>en-us</language>


<?php foreach ($news1Records as $record): ?>
<item>
<title><?php echo htmlspecialchars($record['title']) ?></title>
<link>http://www.mydomain.com/<?php echo $record['_link'] ?></link>
<description><?php echo htmlspecialchars($record['summary']); ?></description>
<pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
<guid isPermaLink="true">http://www.mydomain.com/<?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>

</channel>
</rss>


I did notice that the code calls on the field 'summary' - should this not be content? Anyway I tried 'content' instead of 'summary', without joy. Assuming it should be content, how can I limit the number of words being pulled into the RSS feed - I do not really wish to put all the words into the feed.

Any ideas as to what is going wrong? Still at the testing stage, but I have three or four dummy news items up and working on the site.

Thanks.

Re: [isdoo] RSS not pulling in any info

By Damon - June 17, 2009

Hi,

I just followed the steps to set up an RSS feed had not problems in either IE or Firefox. Here is the link for anyone else interested in setting up an RSS feed:
http://www.interactivetools.com/docs/cmsbuilder/rss_feeds.html

The only things I can think of suggesting is that you check that your path to the viewer functions is correct as well as all your variable names are correct.

Also, can you post a link to the RSS page?
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] RSS not pulling in any info

By isdoo - June 17, 2009

http://www.fansfocus.com/news/rss.xml.php

The path is correct, otherwise the pages would not work as in http://www.fansfocus.com/news/index.php/league-Conference

Thanks.

Re: [isdoo] RSS not pulling in any info

By Damon - June 17, 2009

Take a look at the results for your page using the W3C Feed Validation Service here:
http://validator.w3.org/feed/check.cgi?url=http://www.fansfocus.com/news/rss.xml.php

The & in the first article is causing an issue, the summary isn't being generated correctly and also (all though not an issue) you have an additional forward slash in your URLs:
http://www.fansfocus.com//

Hope that helps.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [isdoo] RSS not pulling in any info

By ross - June 18, 2009

Hi there.

Thanks for the update!

My first though with your feed would be to actually create a new field in your system called "RSS description". You would want to set that up as a regular textfield (without the WYSIWYG options) which will help with the HTML special characters. You can also limit the characters there as well.

Does that sound like it would work for you? Let me know :). You could actually just use a PHP script on your page to limit the length, but that would probably start chopping sentences right in half.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] RSS not pulling in any info

By isdoo - June 18, 2009

Solved this by (posted for the benefit of others who may also require it.)

<?php

// Usage: < ?php print maxWords($content, 25); ? >
function maxWords($textOrHtml, $maxWords) {
$text = strip_tags($textOrHtml);
$words = preg_split("/\s+/", $text, $maxWords+1);
if (count($words) > $maxWords) { unset($words[$maxWords]); }
$output = join(' ', $words);

return $output;
}
?>


<?php foreach ($news1Records as $record): ?>
<item>
<title><?php echo htmlspecialchars($record['title']) ?></title>
<link>http://www.fansfocus.com<?php echo $record['_link'] ?></link>
<description><?php echo maxWords(htmlspecialchars($record['content']), 75); ?>....</description>
<pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
<guid isPermaLink="true">http://www.fansfocus.com<?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>


I am limiting the words to say 75 words and ten adding a ....

after all I want anyone reading it to come to the site to view the full article :)

Thanks again.