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

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

Beefed up RSS2 template for consumption with the Google Feed API Slide Show Control

// description of your code here

   1  xml.instruct!
   2  
   3  # RSS2 rxml template based on: http://snippets.dzone.com/posts/show/558
   4  xml.rss "version" => "2.0", \
   5          "xmlns:dc" => "http://purl.org/dc/elements/1.1/", \
   6          "xmlns:media" => "http://search.yahoo.com/mrss/" do
   7  
   8      xml.channel do
   9  
  10          xml.title       "foto-foo :: public timeline"
  11          xml.link        url_for :only_path => false, :controller => 'feeds'
  12          xml.pubDate     CGI.rfc1123_date(@images.first.updated_at) if @images.any?
  13          xml.description "foto-foo :: public timeline image feed"
  14  
  15          host = "AWS.S3.storage.host"
  16          @images.each do |img|
  17              img.url = "http://#{host}/#{img.name}"
  18              xml.item do
  19                  xml.title       img.name
  20                  xml.link        url_for :only_path => false, :controller => 'feeds', :action => 'show', :id => img.id
  21                  xml.description "<a href='#{img.url}'><img src='#{img.url}'/></a>"
  22                  xml.enclosure :url => "#{img.url}", :type => "image/jpg"
  23  
  24                  xml.pubDate     CGI.rfc1123_date img.updated_at
  25                  xml.guid        url_for :only_path => false, :controller => 'posts', :action => 'show', :id => img.id
  26                  xml.author      "\"user-#{img.user_id}\" (#{img.user_id}@foto-foo.com)"
  27  
  28                  xml.media :group do
  29                      xml.media :title, img.name
  30                      xml.media \
  31                          :content, :type => "#{img.mime}", :medium => "image", \
  32                          :url => "#{img.url}"
  33                          xml.media :credit, "#{img.credit.txt}", \
  34                                  :role => "#{img.credit.role}" 
  35                      xml.media :description, "#{img.desc}", :type => 'plain'
  36                      xml.media :keywords, "#{img.tags}"
  37                      xml.media :thumbnail, \
  38                          :width => "#{img.thumbnail.widh}", \
  39                          :height => "#{img.thumbnail.height}", \
  40                          :url => "#{img.thumbnail.url}"
  41                  end
  42              end
  43          end
  44  
  45      end
  46  end
  47  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS