Version avec modules séparés !
This commit is contained in:
38
modules/weather/includes/GoogleMeteo.php
Normal file
38
modules/weather/includes/GoogleMeteo.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require('class/GoogleWeather.class.php');
|
||||
|
||||
//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
|
||||
if($ville != '' || $ville != null){
|
||||
$gweather = new GoogleWeatherAPI($ville,'fr');
|
||||
|
||||
if($gweather->isFound()) {
|
||||
$city = $gweather->getCity();
|
||||
$currentTemp = $gweather->getCurrent();
|
||||
$forecastTemp = $gweather->getForecast();
|
||||
|
||||
$present_weather = 'Actuellement : '.$currentTemp['temp_c'].'°C - '.$currentTemp['condition'];
|
||||
$i=0;
|
||||
foreach($forecastTemp as $temp) {
|
||||
${'future_weather'.$i} = $temp['day_of_week'].' : '.$temp['low'].'°C | '.$temp['high'].'°C - '.$temp['condition'];
|
||||
$i++;
|
||||
}
|
||||
|
||||
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
|
||||
<?}
|
||||
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
|
||||
<?}
|
||||
}else{ $present_weather = 'Ville non trouvé : '.$city; }
|
||||
}else
|
||||
$present_weather = 'Ville non renseignée';
|
||||
|
26
modules/weather/includes/meteo.php
Normal file
26
modules/weather/includes/meteo.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
if ($weather = simplexml_load_file('http://www.my-meteo.fr/meteo+rss+paris.html')){
|
||||
$present_weather = $weather->channel->item[0]->title;
|
||||
$future_weather1 = $weather->channel->item[1]->title;
|
||||
$future_weather2 = $weather->channel->item[2]->title;
|
||||
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/soleil.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/nuage.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/peunuage.css">
|
||||
<?}
|
||||
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/pluie.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/neige.css">
|
||||
<?}
|
||||
}
|
||||
else
|
||||
{
|
||||
die ('Flux RSS non trouvé');
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user