Hi towtimes,
One thing that I noticed is that you have one too many closing ")" after the line 'equipment_manufacturers' => 'equipment_manufacturerNum')
Here are some recipes on RSS feeds from my CMSB Cookbook
http://www.thecmsbcookbook.com that might help.
Best,
Jerry Kornbluth
CREATING AN RSS FEED FOR A MULTI-RECORD SECTIONIf you’ve had mixed results trying to create an RSS feed for a multi-record section you’re not alone. There seem to be many
“details” for the “Devil” to hide in.
Here’s an approach that worked for me which you can build on for your own uses.
For a table called “current_events”, I wanted to show the most current records in my events list and limit the RSS display to only the
2 most recently created records. I also wanted a masthead logo and a link to the main event’s page to appear at the top of the feed.
The code that I finally came up with for the XML file I named happening-now-rss.xml.php is:
<?php header('Content-type: application/xml; charset=utf-8'); ?><?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php
require_once "/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/cmsAdmin/lib/viewer_functions.php";
list($current_eventsRecords, $current_eventsMetaData) = getRecords(array(
'Table name' => 'current_events',
'orderBy' => 'createdDate DESC',
'limit' => '2',
));
?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://www.artistsofpalmbeachcounty.org/rss/happening-now-rss.xml.php" rel="self" type="application/rss+xml" />
<title>ARTISTS OF PALM BEACH COUNTY - HAPPENING NOW RSS FEED</title>
<link>http://www.artistsofpalmbeachcounty.org/events.php</link>
<description>Arts Events Worth Knowing About</description>
<language>en-us</language>
<item>
<title>www.artistsofpalmbeachcounty.org</title>
<description>
<![CDATA[
<div align="left">
<a href="http://www.artistsofpalmbeachcounty.org"><img src="http://www.artistsofpalmbeachcounty.org/images/APBC-LOGO.png" /></a><br />These
are the latest two events that were added to our <b>Happening Now</b> events list. For a complete list of events <a
href="http://www.artistsofpalmbeachcounty.org/events.php" target="_blank">click here</a>.<br /><b><i>The date is when the event was
added.</i></b></div>
]]>
</description>
<guid isPermaLink="true">http://www.artistsofpalmbeachcounty.org</guid>
<pubDate><?php echo date('r'); ?></pubDate>
</item>
<?php foreach ($current_eventsRecords as $record): ?>
<item>
<?php $title = htmlspecialchars($record['title']); ?>
<title><![CDATA[<?php echo strtoupper($title); ?><?php if ($record['end_date']): ?> - Now through <?php echo $record['end_date'] ?><?php
endif; ?> ]]></title>
<link>http://www.artistsofpalmbeachcounty.org<?php echo $record['_link'] ?></link>
<description><?php echo htmlspecialchars($record['rss_description']); ?></description>
<pubDate><?php echo date("D, d M Y H:i:s O", strtotime($record['createdDate'])) ?></pubDate>
<guid isPermaLink="true">http://www.artistsofpalmbeachcounty.org<?php echo $record['_link'] ?></guid>
</item>
<?php endforeach ?>
</channel>
</rss>
Here are some of the things that I learned along the way.
This code in the example above makes Atom feeds happier.:
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://www.artistsofpalmbeachcounty.org/rss/happening-now-rss.xml.php" rel="self" type="application/rss+xml" />
You can include an image in your channel (not in an item) but it may or may not appear at the upper right corner of your feed depending on
the feed reader that you’re using.
If you’re embedding an image in the <channel> area it’s preferable to have your image title match the channel title.
If you want to include a logo image, you can try to include it in a separate <item> instead if in the channel area (it will not always
appear at the top of your feed unless you add <pubDate><?php echo date('r'); ?></pubDate> to that item).
The date format "D, d M Y H:i:s O insures that your date will render in the appropriate format for RSS feeds.
VALIDATING AN RSS FEEDYou should validate your RSS feed before you publish it. You can do that here:
http://www.validator.w3.org/feed/
You can find out more about the tags that are available for use in you feed at:
http://www.rss-specifications.com/
EMBEDDING AN IMAGE IN AN RSS FEEDRSS feeds can be finicky, but this should work to display an image as part of an item in the foreach loop.
<description>
<![CDATA[
<p><u>Here is an image thumbnail</u> </p>
<?php foreach ($record['image'] as $upload): ?>
<img src="http://www.my_web_site.com<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo
$upload['thumbHeight'] ?>" alt="" />
<?php endforeach ?></p>
<p align="center"><strong><font color="#ba1419">My First Image</font></strong></p>
]]>
</description>
In general, any time you want to treat code as "code" in an RSS feed, you need to surround the code with CDATA tags.
Note: You'll have to add the URL to change the relative image thumbURLpath location to an absolute URL.
Any code (formatting, etc) within the CDATA tags will be treated as code and should render correctly.
RSS FEED CAVEATSHere are a few things that I’ve discovered that may save you some time.
You can only add CDATA to fields in an <item> area
Some readers and browsers will not render an <item> correctly without a <guid> or a <title>
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php