<cfset NumberOfFeedItems = 10>

<cfquery name="getLatestPublishedArticles" datasource="yourDB">
SELECT     TOP #numberOfFeedItems# *
FROM         yourContent
ORDER BY PublishedDate DESC
</cfquery>

<cfset theDatetime = "#dateformat(now(), "ddd, dd mmm yyyy")# #timeformat(now(), "HH:mm:ss")# PST">

<cfsetting enablecfoutputonly="yes">
<cfsavecontent variable="theXML">

<cfoutput>
<?xml version="1.0" ?>
<!--  RSS generated by DevX on #theDatetime# -->
<rss version="2.0">
<channel>
    <title>DevX Featured Content</title>
    <link>http://www.devx.com</link>
    <description>Latest DevX Content</description>
    <language>en-us</language>
    <copyright>Copyright 2002 DevX</copyright>
    <docs>http://backend.userland.com/rss</docs>
    <lastBuildDate>#theDatetime#</lastBuildDate>
    <image>
    <title>DevX</title>
    <url>http://www.devx.com/assets/devx/3182.gif</url>
    <link>http://www.DevX.com</link>
    </image>
</cfoutput>

<cfloop from="1" to = "#numberOfFeedItems#" index="ctr">
    
    <cfscript>
      title = replace(getContent.title[ctr], "<", "&lt;", "ALL")
      description = replace(getContent.abstract[ctr], "<", "&lt;", "ALL");
      description = replace(description, "&", "&amp;", "ALL");      
      date = dateformat(getContent.dateFirstPublished[ctr], "ddd, dd mmm yyyy");
      time = timeformat(getContent.dateFirstPublished[ctr], "HH:mm:ss") & " PST";
      author = replace(getContent.author[ctr], "<", "&lt;", "ALL");
      pubDate = date & " " & time;
    </cfscript>
    
    <cfoutput>
    <item>
	<title>#title#</title>        
<description>#description#</description>
<link>http://www.devx.com/content/id/#getContent.content_id[ctr]#</link>
    	<author>#authors#</author>
        <pubDate>#pubDate#</pubDate>
    </item>
    </cfoutput>
</cfloop>

<cfoutput>
</channel>
</rss>
</cfoutput>

</cfsavecontent>

<cffile action="write" file="c:\devx\syndication\outgoing\devxFeed.xml" output="#theXml#">

<cfcontent type="text/xml">
<cfoutput>#theXml#</cfoutput>


