|
Revision 17836, 1.2 kB
(checked in by zellerda, 4 years ago)
|
Update README
|
| Line | |
|---|
| 1 |
sfWeather plugin |
|---|
| 2 |
============== |
|---|
| 3 |
|
|---|
| 4 |
This plugin will get to you the weather information from Weather.com |
|---|
| 5 |
|
|---|
| 6 |
Documentation |
|---|
| 7 |
--------------------- |
|---|
| 8 |
|
|---|
| 9 |
At the first time, you have to register an account to weather.com XML Weather Services (In the account profile). |
|---|
| 10 |
Next you will recive an partner ID and an Licence Key (totaly free). |
|---|
| 11 |
|
|---|
| 12 |
In app.yml |
|---|
| 13 |
|
|---|
| 14 |
all: |
|---|
| 15 |
weather: |
|---|
| 16 |
partner: 1039925757 # Your weather.com partner ID |
|---|
| 17 |
licence: 709b14c526eae8ee # Your weather.com licence key |
|---|
| 18 |
|
|---|
| 19 |
In your action |
|---|
| 20 |
|
|---|
| 21 |
[php] |
|---|
| 22 |
$w = new sfWeather('SZXX0022'); // City code, in the example (Montreux, Switzerland) |
|---|
| 23 |
$w->setUnit('c'); // "c" for celsius or "f" for Fahrenheit |
|---|
| 24 |
$w->setForecast(2); // The number of the days for the forecast |
|---|
| 25 |
|
|---|
| 26 |
$this->weather_data = $w->retrieve(); // Retrive the data from weather.com |
|---|
| 27 |
|
|---|
| 28 |
You can show the value with a simple print_r('weather_data') |
|---|
| 29 |
|
|---|
| 30 |
Example |
|---|
| 31 |
--------------------- |
|---|
| 32 |
|
|---|
| 33 |
An example is included in the package |
|---|
| 34 |
|
|---|
| 35 |
* Enabled "sfweatherplugin" in "enabled_module" setting in your settings.yml |
|---|
| 36 |
* Just type http://localhost/main_dev.php/sfweatherplugin |
|---|
| 37 |
|
|---|
| 38 |
 |
|---|