Weather forecast snippet
I've tried a couple of weather modules, but none of them seems to work properly. That's why I've turned to MSN Weather RSS feeds and used built in Aggregator module for my Corsica weather page. Here is how to do it:
1) Turn the Aggregator module on.
2) Select a RSS feed from MSN Weather and subscribe to it.
3) Enable Cron or at least the Poormanscron module.
4) Put the following PHP snippet in the page, where you want to show the current weather conditions and the 5-day weather forecast:
<?php
// Show Current conditions
$output = '';
$result = db_query("
SELECT a.*
FROM {aggregator_item} a
WHERE (a.fid=1) AND (a.title LIKE '%Current Conditions%')
ORDER BY a.timestamp DESC, iid DESC
LIMIT 1
");
while ($item = db_fetch_object($result)) {
$output .= '
' . check_plain($item->title) . '
';
if ($item->description) {
$output .= '
'. aggregator_filter_xss($item->description) . "
\n";
}
}
print $output;
// Show 5-day weather forecast
$output = '';
$result = db_query("
SELECT a.*
FROM {aggregator_item} a
WHERE (a.fid=1) AND (a.title LIKE '%Forecast%')
ORDER BY a.timestamp DESC, iid DESC
LIMIT 1
");
while ($item = db_fetch_object($result)) {
$output .= '
' . check_plain($item->title) . '
';