CMSSimplepie and Yahoo Weather

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
czokalapik
New Member
New Member
Posts: 2
Joined: Fri Jul 02, 2010 10:56 pm

CMSSimplepie and Yahoo Weather

Post 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
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: CMSSimplepie and Yahoo Weather

Post 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"
Last edited by kermit on Sat Jul 03, 2010 3:04 am, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
czokalapik
New Member
New Member
Posts: 2
Joined: Fri Jul 02, 2010 10:56 pm

Re: CMSSimplepie and Yahoo Weather

Post by czokalapik »

thank you!
works perfect
Locked

Return to “Modules/Add-Ons”