AccuWeather
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Drupal 7.x version will be ready soon, once the 6.x is stable. Please, be patient:)
About
AccuWeather module allows to display weather data from AccuWeather.com. There are three ways to show up a weather right now:
- view a full page based on a current location either a given one in a search form,
- assing a block e.g. to the frontpage for all website users, based on a predefined location in module's settings (e.g. country capital city),
- assign a block to the users profile pages (block will show a weather for the user's location based on a "Profile" or "Content profile" location field (simple textfield right now, no Geolocation module's integration yet),
Notice for user block: if user's profile location causes that AccuWeather returns more than one location, user is informed and obliged to select proper location from the list on his/hers own. Then the weather for the selected location will be displayed.
Features
- easy theming through *.tpl.php files
- weather data refresh on cron run or after 15 minutes while any user visit a website
- predefined custom CSS stylesheet (can be disabled in admin settings, to setup your own theme)
- loading a weather for users based on their profile location (configurable in admin settings)
- module integrates with Profile and Content Profile modules to grab fields/CCK fields for location selection
- metric or imperial data system (configurable in admin settings)
- config amount of forecast display items both on weather page and in the blocks
- some fancy weather icons :)
Configuration
Go to Site configuration › AccuWeather settings and configure thing you need to.
Then visit Site building › Blocks and assing AccuWeather block or/and AccuWeather user block into whichever region you want.
Important: weather in blocks will be available if the user profile location field either default location is configured.
Requirements:
- ImageCache
- Transliteration
- SimpleXML library available
- cURL library available
- PHP5.1+
For developers:
Module has implemented it's own hook to process the location results. Example usages:
- limit location results by removing unnecessary location via country code filtering (example code below to use in a custom module)
/**
* Implementation of hook_accuweather_locations().
*/
function MYMODULE_accuweather_locations($op = 'list', &$data = array()) {
foreach ($data['locations'] as $index => $location) {
if (substr($location, 0, 6) == 'EUR|PL') {
$continue = TRUE;
}
}
if ($continue) {
foreach ($data['locations'] as $index => $location) {
$data['items'][$index] = str_replace('(', ' (', $data['items'][$index]);
if (substr($location, 0, 6) != 'EUR|PL') {
unset($data['locations'][$index], $data['items'][$index]);
}
}
}
return $data;
}Country limitation appended right now via hook_accuweather_locations() will be probably merged into the admin settings in v. 2.0, with CountriesAPI (D6) / Countries (D7) integration (i think so:)).
