From 8a2037f2c89d459ad9e1e4e6703b04d01dda96c5 Mon Sep 17 00:00:00 2001 From: Lorenzo Giacomelli Date: Wed, 7 Dec 2016 16:28:51 +0100 Subject: [PATCH] =?UTF-8?q?non=20prova=20pi=C3=B9=20a=20leggere=20il=20fil?= =?UTF-8?q?e=20del=20meteo=20se=20non=20esiste=20il=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/lib/gui/HTMLHelper.php | 60 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/private/lib/gui/HTMLHelper.php b/private/lib/gui/HTMLHelper.php index 88f9c1c..f632ef8 100644 --- a/private/lib/gui/HTMLHelper.php +++ b/private/lib/gui/HTMLHelper.php @@ -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; - - - ?> -
Meteo Napoli
-
-
-
Oggi
-
°
-
Max: °
-
Min: °
-
-
Domani
-
°
-
Max: °
-
Min: °
+ 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; + + + ?> +
Meteo Napoli
+
+
+
Oggi
+
°
+
Max: °
+
Min: °
+
+
Domani
+
°
+
Max: °
+
Min: °
+
-
-