non prova più a leggere il file del meteo se non esiste il file
This commit is contained in:
@@ -36,36 +36,38 @@ class HTMLHelper {
|
||||
|
||||
public static function getMeteoBlock(){
|
||||
$config = GlobalVariables::get("config");
|
||||
$cont = file_get_contents($config->files->meteoCache);
|
||||
$json = json_decode($cont);
|
||||
|
||||
$todayImgUrl = " http://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png";
|
||||
$todayTemp = $json->list[0]->main->temp;
|
||||
$todayMax = $json->list[0]->main->temp_max;
|
||||
$todayMin = $json->list[0]->main->temp_min;
|
||||
|
||||
$tomorrowImgUrl = " http://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png";
|
||||
$tomorrowTemp = $json->list[1]->main->temp;
|
||||
$tomorrowMax = $json->list[1]->main->temp_max;
|
||||
$tomorrowMin = $json->list[1]->main->temp_min;
|
||||
|
||||
|
||||
?>
|
||||
<div class="meteoTitle">Meteo Napoli</div>
|
||||
<div class="meteo">
|
||||
<div class="today">
|
||||
<div class="day">Oggi</div>
|
||||
<div class="image"><img src="<?php echo $todayImgUrl;?>" alt="" /><?php echo $todayTemp;?>°</div>
|
||||
<div><span class="label">Max:</span> <?php echo $todayMax;?>°</div>
|
||||
<div><span class="label">Min:</span> <?php echo $todayMin;?>°</div>
|
||||
</div><div class="tomorrow">
|
||||
<div class="day">Domani</div>
|
||||
<div class="image"><img src="<?php echo $tomorrowImgUrl;?>" alt="" /><?php echo $tomorrowTemp;?>°</div>
|
||||
<div><span class="label">Max:</span> <?php echo $tomorrowMax;?>°</div>
|
||||
<div><span class="label">Min:</span> <?php echo $tomorrowMin;?>°</div>
|
||||
if(file_exists($config->files->meteoCache)){
|
||||
$cont = file_get_contents($config->files->meteoCache);
|
||||
$json = json_decode($cont);
|
||||
|
||||
$todayImgUrl = " http://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png";
|
||||
$todayTemp = $json->list[0]->main->temp;
|
||||
$todayMax = $json->list[0]->main->temp_max;
|
||||
$todayMin = $json->list[0]->main->temp_min;
|
||||
|
||||
$tomorrowImgUrl = " http://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png";
|
||||
$tomorrowTemp = $json->list[1]->main->temp;
|
||||
$tomorrowMax = $json->list[1]->main->temp_max;
|
||||
$tomorrowMin = $json->list[1]->main->temp_min;
|
||||
|
||||
|
||||
?>
|
||||
<div class="meteoTitle">Meteo Napoli</div>
|
||||
<div class="meteo">
|
||||
<div class="today">
|
||||
<div class="day">Oggi</div>
|
||||
<div class="image"><img src="<?php echo $todayImgUrl;?>" alt="" /><?php echo $todayTemp;?>°</div>
|
||||
<div><span class="label">Max:</span> <?php echo $todayMax;?>°</div>
|
||||
<div><span class="label">Min:</span> <?php echo $todayMin;?>°</div>
|
||||
</div><div class="tomorrow">
|
||||
<div class="day">Domani</div>
|
||||
<div class="image"><img src="<?php echo $tomorrowImgUrl;?>" alt="" /><?php echo $tomorrowTemp;?>°</div>
|
||||
<div><span class="label">Max:</span> <?php echo $tomorrowMax;?>°</div>
|
||||
<div><span class="label">Min:</span> <?php echo $tomorrowMin;?>°</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user