DIV CSS 佈局教程網

rails制作rss feed
編輯:關於JavaScript     

在網上Google了很多次,能找到用rails制作rss,但是總是找不到完整的。今天把完整的過程抄錄在這裡:

方法A:

就是你自己把RSS XML的格式拼湊好,輸出.並設置HTTP Header ,標記content-type為application/XML,常見的代碼:

#Post_controller::feed()
          def feed
                                                require "rss"
                                                articles = Article.find :all, :order => 'post_date DESC', :limit => 10
                                                feed = RSS::Maker.make("2.0") do |maker|
                                                        maker.channel.title = "Gang of Technology"
                                                        maker.channel.description = "Gang of Technology site"
                                                        maker.channel.link = "http://up-u.com"
                                
                                                        maker.it

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved