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
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
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?
<title>Great Hits</title>
<link>http://localhost:3000/products</link>
<description>Greatist rock hits ever!!</description>
<sellername>JAY01</sellername>
<selleremail>[email protected]</selleremail>
<title>Trek</title>
<link>http://localhost:3000/products</link>
<description>Proffesional Trek riding bike, want to sell for no less
than £50. The bike can be delivered or can be collected. Please
contact via email.
JG02 [email protected]
Whats appears on site
Trek
Proffesional Trek riding bike, want to sell for no less than £50. The
bike can be delivered or can be collected. Please contact via email.
I believe you are missing 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.
----- Original Message -----
From: “Alan Red” [email protected]
To: [email protected]
Sent: Friday, March 21, 2008 5:38 AM
Subject: [Rails] Re: RSS feed help
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?
<title>Great Hits</title>
<link>http://localhost:3000/products</link>
<description>Greatist rock hits ever!!</description>
<sellername>JAY01</sellername>
<selleremail>[email protected]</selleremail>
<title>Trek</title>
<link>http://localhost:3000/products</link>
<description>Proffesional Trek riding bike, want to sell for no
less
than £50. The bike can be delivered or can be collected. Please
contact via email.
JG02 [email protected]
I believe you are missing 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.
----- Original Message -----
From: “Alan Red” [email protected]
To: [email protected]
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.