RSS feed help

I have created a xml file that I want to change into and rss feed and then parse it so it looks anyother rss feed. The file takes data from my database but I am at a loss on how to get this to an rss feed, can anyone help?

view

xml.instruct! :xml, :version=>"1.0"   xml.product_record do     @products.each do |p|       xml.itemtype(p.item_type)       xml.itemname(p.item_name)       xml.description(p.description)       xml.sellername(p.seller_name)       xml.selleremail(p.seller_email)   end end

controller

class InfoController < ApplicationController     def prodlist       @products = Product.find(:all, :order=> "item_name")       render :layout => false       end end

Hey Alan. Here's how I create RSS in Rails:

view

xml.instruct!

xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/ 1.1/" do   xml.channel do     @products.each do |p|       xml.title(p.item_name)       xml.link(url_for :only_path => false, :controller => 'products')       xml.description(p.description)     end   end end

That'd get you the basics. Is that all you need?

ESPNDev

ESPNDev@gmail.com wrote:

Hey Alan. Here's how I create RSS in Rails:

view

xml.instruct!

xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/ 1.1/" do   xml.channel do     @products.each do |p|       xml.title(p.item_name)       xml.link(url_for :only_path => false, :controller => 'products')       xml.description(p.description)     end   end end

That'd get you the basics. Is that all you need?

ESPNDev

That works really well, not sure why it only shows one item will have to figure taht out but definatly a great starting point thanks.

Ok I tried ro find out whats wrong by validating the rss feed and it complains that there are too many titles and such. I believe this could be the problem as to why is not showing all the products but im at quite a loss can anyone help?

source code

<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/ 1.1/">   <channel>     <title>Fiat</title>     <link>http://localhost:3000/products&lt;/link&gt;     <description>In good condition, 5 years old.</description>     <sellername>KLSexxy</sellername>     <selleremail>her2stay@wlv.com</selleremail>

    <title>Great Hits</title>     <link>http://localhost:3000/products&lt;/link&gt;     <description>Greatist rock hits ever!!</description>     <sellername>JAY01</sellername>     <selleremail>JAY01@HOTMAIL.COM</selleremail>     <title>Trek</title>

    <link>http://localhost:3000/products&lt;/link&gt;     <description>Proffesional Trek riding bike, want to sell for no less than &#163;50. The bike can be delivered or can be collected. Please contact via email.</description>     <sellername>JG02</sellername>     <selleremail>heresay@hotmail.co.uk</selleremail>   </channel> </rss>

Whats appears on site

Trek

I believe you are missing <item></item> tags. You need to wrap each product as an item grouping. For examples of a working RSS feed I suggest you pull your favorite source and have a look inside.

-- Long http://FATdrive.tv/wall/trakb/10-Long http://FATdrive.tv/ - store, play, share

Long wrote:

I believe you are missing <item></item> tags. You need to wrap each product as an item grouping. For examples of a working RSS feed I suggest you pull your favorite source and have a look inside.

-- Long http://FATdrive.tv/wall/trakb/10-Long http://FATdrive.tv/ - store, play, share

From: "Alan Red" <rails-mailing-list@andreas-s.net> To: <rubyonrails-talk@googlegroups.com> Sent: Friday, March 21, 2008 5:38 AM Subject: [Rails] Re: RSS feed help

Long thanks so much, got it fully working. It looks fantastic considering its only for a uni project but every bit counts thanks again