Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Peter Cooperx http://www.petercooper.co.uk/

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

RFC-822 compatible dates in RSS feeds

If you're building RSS 2.0 files with .rxml files on your Rails app, this sort of line will get you a valid date/time:

   1  xml.pubDate(p.updated_at.strftime("%a, %d %b %Y %H:%M:%S %z"))


If you're just using strftime someplace else, perhaps in PHP, try:

   1  strftime("%a, %d %b %Y %H:%M:%S %z")

RSS feed in .rxml template

   1  xml.rss('version' => '2.0') do
   2    xml.channel do 
   3      xml.title(page_title)
   4      xml.link(@request.protocol + @request.host_with_port + url_for(:rss => nil))
   5      xml.description(page_title)
   6      @posts.each { |p|
   7        xml.item do 
   8          xml.title(p.title)
   9          xml.link(@request.protocol + @request.host_with_port + url_for(:controller => "posts", :action => "show", :id => p.id))
  10          xml.description(niceify_html_for_rss(p.content))
  11          xml.pubDate(p.updated_at)
  12        end
  13      }
  14    end
  15  end

Atom / RSS feed of your GMail account

   1  https://USERNAME:PASSWORD@gmail.google.com/gmail/feed/atom
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS