Easy... move cfoutput to just before </cfsavecontent>

-----Original Message-----
From: Daniel Kessler [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 12, 2005 1:31 PM
To: CF-Talk
Subject: no /channel for my rss

I've been trying to export my database to an xml file.  While largely  
successful, I'm still having troubles.  With the code below,  
everything works fine except that it doesn't put the </channel></rss>  
at the bottom of the page, but instead ends with </item>.   I need  
those tags for proper rss validation.

The file:
http://hhp.umd.edu/rss/whats_new.xml

The failed validation:
http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fhhp.umd.edu%2Frss% 
2Fwhats_new.xml

A here's the code:

<cfquery name="retrieve_xml" datasource="dpch">
SELECT header,description,id FROM whats_new
ORDER BY id DESC
</cfquery>

<cfsavecontent variable="xml"><?xml version="1.0" ?>
<rss version="2.0">

<channel>

<title>Health and Human Performance - What's New</title>
<description>This is the University of Maryland's College of Health  
and Human Performance list of What's new items.</description>
<link>http://hhp.umd.edu</link>

<cfoutput query="retrieve_xml">
        <cfset desc_length = 400>
        <CFIF LEN(description) gt desc_length>
                <CFSET desc = LEFT(description,desc_length)>
                <cfset desc = ListDeleteAt(desc, ListLen(desc, " "), " ")>
<!---  
deletes to the last full word --->
                <cfset desc = desc & "...">
        <cfelse>
                <CFSET desc = description>
        </CFIF>
        <CF_RENoTags
                input="#desc#"
                variable="desc"
        >
        
        <cfset the_header = header>
        
        <CF_RENoTags
                input="#header#"
                variable="the_header"
        >
<item>
<title>#the_header#</title>
<description>#desc#</description>
<link>http://hhp.umd.edu/whats_new.cfm?id=#id#</link>
</item>
</cfoutput>
</channel>
</rss>
</cfsavecontent>
<cffile action="write" file="#CurrentDir#rss/whats_new.xml"  
output="#xml#" addnewline="no">


thanks for any help, or just for listening.

_____________________________

Daniel Kessler

College of Health and Human Performance
University of Maryland
Suite 2387 Valley Drive
College Park, MD  20742-2611
Phone: 301-405-2545
http://hhp.umd.edu






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226812
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to