RSS feed only showing one entry

5 posts by 3 authors in: Forums > CMS Builder
Last Post: May 2, 2013   (RSS)

By meg - May 1, 2013

I'm working with another client on an RSS feed. I set it up through the CMS, but it's only showing one entry out, when there should be many. Any reason why this happens?

By gregThomas - May 2, 2013

Hi,

Would it be possible to include or attach the code from your RSS feed into a post for me? The most likely issue is that there is a limit in your getRecords function:

  // load records from 'blog'
  list($blogRecords, $blogMetaData) = getRecords(array(
    'tableName'   => 'blog',
    'orderBy'     => '',   // use default database order
    'loadUploads' => false,
    'limit'       => '1',
    'allowSearch' => false,
  ));

If you have a limit like the one above in your getRecords function, if you remove it all of the posts should be displayed.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By meg - May 2, 2013

<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<'.'?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

// load viewer library
$libraryPath = 'admin/lib/viewer_functions.php';
$dirsToCheck = array('/home/olddutchchurch/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records from 'calendar'
list($calendarRecords, $calendarMetaData) = getRecords(array(
'tableName' => 'calendar',
'orderBy' => '', // use default database order
'loadUploads' => true,
'allowSearch' => false,
));

?>
<rss version="2.0">
<channel>
<title></title>
<link></link>
<description></description>
<pubDate><?php echo date('r') ?></pubDate>
<language>en-us</language>

<?php foreach ($calendarRecords as $record): ?>
<item>
<title><?php echo htmlencode($record['date']) ?>, <?php echo htmlencode($record['title']) ?></title>
<link><?php echo $record['_link'] ?></link>
<description><![CDATA[<?php echo $record['content'] ?>]]></description>
<pubDate><?php echo date('r', strtotime($record['createdDate'])) ?></pubDate>
<guid isPermaLink="true"><?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>
</channel>
</rss>

By Dave - May 2, 2013

Hi meg, 

Or if you want to try one more thing, add this line in red to your getRecords() call: 

// load records from 'calendar'
list($calendarRecords, $calendarMetaData) = getRecords(array(
  'tableName' => 'calendar',
  'orderBy' => '', // use default database order
  'loadUploads' => true,
  'allowSearch' => false,
  'debugSql' => true,
));

Then copy and paste the output into the forum.  That will show us the exact query that is being sent to MySQL.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com