Thanks, Ian, huge help.

In case anyone else is going through this exercise, here is an initial
version:

<!--- Uses a Yahoo! weather RSS feed. --->
<!---
 Set a query object that will allow a lookup of weather descriptions.
 If none is found, set response as "not available"
 Dump the query into the application scope to speed up processing
 --->
<cfhttp method="get" url="
http://weather.yahooapis.com/forecastrss?p=19426&u=f";></cfhttp>
<cfscript>
 wx = trim(cfhttp.filecontent);
 wx = xmlparse(wx);
 wx = wx.rss.channel;
</cfscript>
<cfparam name="application.qryWxCond" default="">
<cfif NOT isQuery("application.qryWxCond")>
 <cfset wxList = "tornado, tropical storm, hurricane, severe thunderstorms,
thunderstorms, mixed rain and snow, mixed rain and sleet, mixed snow and
sleet, freezing drizzle, drizzle, freezing rain, showers, showers, snow
flurries, light snow showers, blowing snow, snow, hail, sleet, dust, foggy,
haze, smoky, blustery, windy, cold, cloudy, mostly cloudy (night), mostly
cloudy (day), partly cloudy (night), partly cloudy (day), clear (night),
sunny, fair (night), fair (day), mixed rain and hail, hot, isolated
thunderstorms, scattered thunderstorms, scattered thunderstorms, scattered
showers, heavy snow, scattered snow showers, heavy snow, partly cloudy,
thundershowers, snow showers, isolated thundershowers">
 <cfset application.qryWxCond = queryNew("code,description")>
 <cfset tmp = queryAddRow(application.qryWxCond, listlen(wxList, ","))>
 <cfset row = 0>
 <cfloop index="i" list="#wxList#" delimiters=",">
  <cfset tmp = querySetCell(application.qryWxCond, "code", row,
incrementvalue(row))>
  <cfset tmp = querySetCell(application.qryWxCond, "description", i,
incrementvalue(row))>
  <cfset row = incrementvalue(row)>
 </cfloop>
</cfif>
<cfdump var="#application.qryWxCond#">
<cffunction name="getWxCode">
 <cfargument name="wxcode" type="numeric" required="Yes">
 <cfquery name="qryWxCode" dbtype="query">
  SELECT  description
  FROM  application.qryWxCond
  WHERE  code = <cfqueryparam cfsqltype="CF_SQL_INTEGER"
value="#arguments.wxcode#">
 </cfquery>
 <cfreturn qryWxCode.description>
</cffunction>
<cfinvoke method="getWxCode" returnvariable="nowWxDescription">
 <cfinvokeargument name="wxcode"
value="#wx.item["yweather:condition"].xmlAttributes["code"]#">
</cfinvoke>
<cfinvoke method="getWxCode" returnvariable="todayWxDescription">
 <cfinvokeargument name="wxcode"
value="#wx.item["yweather:forecast"][1].xmlAttributes["code"]#">
</cfinvoke>
<cfinvoke method="getWxCode" returnvariable="tomorrowWxDescription">
 <cfinvokeargument name="wxcode"
value="#wx.item["yweather:forecast"][2].xmlAttributes["code"]#">
</cfinvoke>
<cfoutput>
<div id="weather">
 <!--- Use the yweather:condition.code value passed in to the image path
--->
 <div id="wxIcon" style="float: right;"><img src="
http://l.yimg.com/us.yimg.com/i/us/we/52/#wx.item["yweather:condition"].xmlAttributes["code"]#.gif";></div
>
 <dl>
  <dt>Weather for #wx["yweather:location"].xmlAttributes["city"]#,
#wx["yweather:location"].xmlAttributes["region"]#</dt>
  <dd>
   Current: #wx.item["yweather:condition"].xmlAttributes["temp"]#,
#nowWxDescription#<br>
   Today:
#wx.item["yweather:forecast"][1].xmlAttributes["low"]#/#wx.item["yweather:forecast"][1].xmlAttributes["high"]#,
#todayWxDescription#<br>
   Tomorrow:
#wx.item["yweather:forecast"][2].xmlAttributes["low"]#/#wx.item["yweather:forecast"][2].xmlAttributes["high"]#,
#tomorrowWxDescription#
  </dd>
 </dl>
</div>
</cfoutput>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278832
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to