Yii 1.1: weather-forecast-widget

Weather Forecasts from the BBC/Yahoo/Google with cacheing support
5 followers

This extension gets and displays weather forecast data from a data provider.

Three providers are provided "out-of-the-box":

  • BBC Weather: Detailed forecast for three days in advance.
  • Google Weather: Description and min/max temperatures for four days in advance
  • Yahoo: Forecast for two days - but the only documented API

The widget supports cacheing to reduce bandwidth in high load applications. Cacheing is on a provider::location basis so if you have forecasts for multiple locations and/or are using multiple providers on a page each is cached.

Comes with CSS and a symbol set, both of which can be overidden with your own.

The release file contains full documentation.

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract weatherForecast directory in the release file under protected/extensions/widgets
  • Extract the documentation directory to a location of your choice.

Usage

See the following code example:

[php]       $this->widget('application.extensions.widgets.weatherForecast.WeatherForecast', array(
        'provider'=>'BBC',
        'params' => array(
        'location'=>'40', // BBCWeather::Paris
          'units' => 'C'
        ),
        'cache'=>array(
          3600, // Cache up to one hour
          new CExpressionDependency("date('H)") // Expire the cache at the top of the hour
        )
       ));

Change Log

October 13, 2009

  • Initial release.

October 18, 2009

  • Now uses Yii DIRECTORY_SEPARATOR constant

Total 2 comments

#1233 report it
Yeti at 2009/10/18 05:46am
@Zolter

Hi, I assume you are refering to line 146 in WeatherForecast.php $file = dirname(FILE) . DS . 'assets' . DS . 'weather_forecast.css';

DS is the directory separator, either '/' or '\' depending on your OS

I do defined('DS') or define('DS',DIRECTORY_SEPARATOR); to save a bit of typing. Will update to the full constant name.

Thanks for spotting.

#1234 report it
Zolter at 2009/10/18 05:16am
error

weatherForecastDSassetsDSweather_forecast.css

what is DS ?

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: Yeti
  • Category: Others
  • Votes: +3
  • Downloaded: 2,384 times
  • Created on: Oct 13, 2009
  • Last updated: Jun 4, 2010