• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

RSS

Explorer ,
Feb 22, 2007 Feb 22, 2007

Copy link to clipboard

Copied

Hi,

I never had done RSS Feed (XML file) before but I now I have to do it. I have the blog site and they want me to put last 10 blog entries output to RSS feed but I never had done it before so I don’t know where I begin to start with.

thanks
TOPICS
Advanced techniques

Views

415

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 22, 2007 Feb 22, 2007

Copy link to clipboard

Copied

A quick google search for "Coldfusion RSS" turned up a slew of articles, including this one:

http://www.webpronews.com/topnews/2004/04/05/creating-your-very-own-rss-xml-feeds-with-coldfusion-mx

Basically, you are going to create a coldfusion page that generates the RSS xml file either on a regular basis or whenever an update is made (your choice), after that its just a matter of supplying the feed URL to your users.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

I have the blog entry form where end-user can submit the blog. When they hit the submit button for adding blog, I take these info and insert into the database and also write the xml file. I look at several examples from the web site and I try to do the same thing but keep getting an error. Please tell me what I did wrong here.

Here the error I got:
====
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'file:///S:/scripts/rss/blog.xml'. Line 1, Position 1

theXML
^

============
Below is the code:
========================================

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

Use CFMXL to create the file. It will do better for formatting. And use CDATA also to validate correctly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

My code now is working fine but it is not working with the way I want. My query returned three records and the xml file should display three different records but it was display the same record for three times. What did I have wrong here?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

LATEST
kt03 wrote:

> <cfloop from="1" to = "#numberOfFeedItems#" index="ctr">
>
> <!--- Then output the fields for each item --->
> <cfoutput>
> <item>
> <title>#author#</title>
> <link>rss.cfm</link>
> <description>#body#</description>
> </item>
> </cfoutput>
> </cfloop>

change the above to:

<cfoutput query="getblog">
<item>
<title>#author#</title>
<link>rss.cfm</link>
<description>#body#</description>
</item>
</cfoutput>

Explanation:
your cfloop + cfoutput construct is wrong:
use just <cfoutput query="getblog"> instead of <cfloop ...><cfoutput>;
since your query already pulls only 3 top records only those will be
cfoutput'ed - no need to loop through anything;
alternatively, you can pull ALL records with your query (drop the TOP
#NumberOfFeedItems#) and then use <cfoutput query="getblog" startrow="1"
maxrows="#NumberOfFeedItems#">

--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

You should be using cfxml instead of cfsavecontent. Your created a loop for the length of your result set but you didn't index anything. If your not going to use the query attribute of cfloop you need to index the variables: #author[ctr]# .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation