Right, I'm working on a site with a couple different RSS feeds. My issue is one of my feeds works just fine, but the second one (based on nearly identical code) fails and I can't figure out why.
Here's the code that works:
<!--- Get the feed data as a query from the orders table. --->
<cfquery name="getNews" datasource="#DSN#">
SELECT * FROM NEWS2
WHERE STATUS = 1
ORDER BY rdate DESC
</cfquery>
<cfset myStruct = StructNew() />
<cfset mystruct.link = "http://noobzilla.net" />
<cfset myStruct.title = "Noobzilla News" />
<cfset mystruct.description = "Programming Related Site Reviews" />
<cfset mystruct.pubDate = Now() />
<cfset mystruct.version = "rss_2.0" />
<cfset myStruct.item = ArrayNew(1) />
<cfloop query="getNews">
<cfset myStruct.item[currentRow] = StructNew() />
<cfset myStruct.item[currentRow].guid = structNew() />
<cfset myStruct.item[currentRow].guid.isPermaLink="YES" />
<cfset myStruct.item[currentRow].guid.value = 'http://noobzilla.net/news-detail.cfm?id=#id#' />
<cfset myStruct.item[currentRow].pubDate = "#DateFormat(getNews.rdate, "mm/dd/yyyy")#" />
<!---<cfset myStruct.item[currentRow].title = xmlFormat(title) />--->
<cfset myStruct.item[currentRow].title = #title# />
<cfset myStruct.item[currentRow].description = StructNew() />
<!---<cfset myStruct.item[currentRow].description.value = xmlFormat(#info#) />--->
<cfset myStruct.item[currentRow].description.value = '#Left(info, 250)#...' />
<cfset myStruct.item[currentRow].link = 'http://noobzilla.net/news-detail.cfm?id=#id#' />
</cfloop>
<!--- Generate the feed and save it to a variable. --->
<cffeed action="create" name="#myStruct#" overwrite="true" xmlVar="myXML" />
The above code works great. Now here's the code from my second file (as you can see its virtually identical, just using a different table):
<!--- Get the feed data as a query from the orders table. --->
<cfquery name="getNews" datasource="#DSN#">
SELECT * FROM NEWS
WHERE STATUS = 1
ORDER BY rdate DESC
</cfquery>
<cfset myStruct = StructNew() />
<cfset mystruct.link = "http://noobzilla.net" />
<cfset myStruct.title = "IDE Reviews" />
<cfset mystruct.description = "IDE and SDK Reviews" />
<cfset mystruct.pubDate = Now() />
<cfset mystruct.version = "rss_2.0" />
<cfset myStruct.item = ArrayNew(1) />
<cfloop query="getNews">
<cfset myStruct.item[currentRow] = StructNew() />
<cfset myStruct.item[currentRow].guid = structNew() />
<cfset myStruct.item[currentRow].guid.isPermaLink="YES" />
<cfset myStruct.item[currentRow].guid.value = 'http://noobzilla.net/news-detail2.cfm?id=#id#' />
<cfset myStruct.item[currentRow].pubDate = "#DateFormat(getNews.rdate, "mm/dd/yyyy")#" />
<cfset myStruct.item[currentRow].title = #title# />
<cfset myStruct.item[currentRow].description = StructNew() />
<cfset myStruct.item[currentRow].description.value = '#Left(info, 250)#...' />
<cfset myStruct.item[currentRow].link = 'http://noobzilla.net/news-detail2.cfm?id=#id#' />
</cfloop>
<!--- Generate the feed and save it to a variable. --->
<cffeed action="create" name="#myStruct#" overwrite="true" xmlVar="myXML" />
This second set of code generates the following error:
There was an error parsing a date specified in pubDate. Unable to convert pubDate to a date.