Re: [Dave] syndicate or RSS feeds
Hi Dave,
I;m also having a problem settting this up. Maybe i'm just tired and missing something really simple, i dunno. My page is called articlerss.php. I;m trying to get the news articles that are posted.
Here is my code:
<?php
header('Content-type: application/xml; charset=utf-8');
require_once "/home/fhlinux152/a/allianceinpartnership.co.uk/user/htdocs/cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'news'; // (REQUIRED) MySQL tablename to list record from. Example: 'article';
$options['titleField'] = 'title'; // (optional) MySQL fieldname used in viewer url for search engines. Example: 'title' would display: viewer.php/article_title_here-123
$options['viewerUrl'] = 'http://www.allianceinpartnership.co.uk/newsPage.php'; // (optional) URL of viewer page. Example: '/articles/view.php';
$options['perPage'] = '10'; // (optional) The number of records to display per page. Example: '5'; Defaults to 10.
$options['orderBy'] = 'title'; // (optional) Fieldnames to sort by. Example: 'field1, field2 DESC, field3';
$options['pageNum'] = '1'; // (optional) Page number of results to display. Example: '1'; Defaults to ?page=# value, or 1 if undefined
list($listRows, $listDetails) = getListRows($options);
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
?>
<rss version="2.0">
<channel>
<title>PUT YOUR SITE NAME HERE</title>
<link>http://EXAMPLE.COM/YOUR/URL/HERE/</link>
<description>YOUR SITE DESCRIPTION GOES HERE</description>
<pubDate><?php echo date('r'); ?></pubDate>
<language>en-us</language>
<?php foreach ($listRows as $record): ?>
<item>
<title><?php echo htmlspecialchars($record['title']) ?></title>
<link><?php echo $record['_link'] ?></link>
<description><?php echo htmlspecialchars($record['summary']); ?></description>
<pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
<guid isPermaLink="true"><?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>
</channel>
</rss>
...all i get is feed code error [:(]
Cheers,
nikki.