WDMA members can upload pictures
22 Dec 2009 - DaveMembers can post pictures throughout the website. Photos link to a harvest or just a note. Members can include pictures in their profile also.
The Yahoo weather widget shows the local conditions and forecast. Here is some of the code to make it work. This is the Ruby components used to query Yahoo for the current local weather. The first part, yweather.rb, goes in the Ruby on Rails web app folder ‘/lib’. The part that manages the view goes in /app/views/layouts/
# /lib/yweather.rb
module Yweather
require 'rubygems'
require 'yahoo-weather'
def Yweather.get_weather
@client = YahooWeather::Client.new
@response = @client.lookup_location('19343')
return @response
end
end
module Yweather
require 'rubygems'
require 'yahoo-weather'
def Yweather.get_weather
@client = YahooWeather::Client.new
@response = @client.lookup_location('19343')
return @response
end
end
<% @yweather = Yweather::get_weather %>
<div style="padding: 2px; font-family: arial; font-size: 7pt; background-color: #fff; color: #030; text-align: center;"><%= @yweather.title %>
<div><img src="%3C%=%20@yweather.image_url%20%%3E" alt="" />
<%= @yweather.condition.temp %> degrees <%= @yweather.units.temperature %>
<%= @yweather.condition.text %>
Forecast:
<%= @yweather.forecasts[0].day %> - <%= @yweather.forecasts[0].text %>. High: <%= @yweather.forecasts[0].high %> Low: <%= @yweather.forecasts[0].low %>
<%= @yweather.forecasts[1].day %> - <%= @yweather.forecasts[1].text %>. High: <%= @yweather.forecasts[1].high %> Low: <%= @yweather.forecasts[1].low %>
More information <a href="%3C%=%20@yweather.page_url%20%%3E">click here</a>.
</div>
</div>
Yahoo’s developer resources are great. And don’t forget to install the Ruby gem.
gem install yahoo-weather