Page 1 of 1

CMSSimplepie and Yahoo Weather

Posted: Fri Jul 02, 2010 11:11 pm
by czokalapik
Hello, i have a problem with Yahoo weather rss feed (http://weather.yahooapis.com/forecastrss?p=PLXX0049&u=c)
I need only name of an icon (i have my own icons), and temperature, so i need capture code and temp attributes from :

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<item>
<yweather:condition  text="Clear"  code="31"  temp="17"  date="Fri, 02 Jul 2010 11:00 pm CEST" />
</item>
</channel>
how do i capture those attributes using cmssimplepie? i have no idea how to even begin.

i will be most thankful for help

Re: CMSSimplepie and Yahoo Weather

Posted: Sat Jul 03, 2010 3:00 am
by kermit
sorry, i don't use the simplepie module, but you can {$thearray|print_r} the array(s) it uses to see if what you're looking for is in it...

i do use the RSS2HTML module, though, and i can tell you that the data you want to use is readily available:

inside the main template loop {foreach from=$rss->items item=item}, use the following:

{$item.yweather.condition_text}
{$item.yweather.condition_code}
{$item.yweather.condition_temp}
{$item.yweather.condition_date}

e.g.

Condition Text: "{$item.yweather.condition_text}"

Condition Code: "{$item.yweather.condition_code}"

Condition Temp: "{$item.yweather.condition_temp}"

Condition Date: "{$item.yweather.condition_date}"

would output something like...:

Condition Text: "Partly Cloudy"
Condition Code: "29"
Condition Temp: "14"
Condition Date: "Sat, 03 Jul 2010 2:00 am CEST"

Re: CMSSimplepie and Yahoo Weather

Posted: Sat Jul 03, 2010 9:35 am
by czokalapik
thank you!
works perfect