; rel=preload; as=image", false); $weatherclass = "Weather_" . $SETTINGS['sources']['weather']; $weather = new $weatherclass(46.595, -112.027); // TODO: get user location $weather->setLocationByUserIP(); $weather->loadForecast(); $tempunits = "C"; $degreesymbol = "°"; if (!empty($_COOKIE['TemperatureUnitsPref']) && preg_match("/[FCK]/", $_COOKIE['TemperatureUnitsPref'])) { $tempunits = $_COOKIE['TemperatureUnitsPref']; // No degree symbol for Kelvins if ($tempunits == "K") { $degreesymbol = ""; } } News::load($SETTINGS["sources"]["news"]); $newsitems = News::getItems(); // Sort by category $itemsbycategory = []; foreach ($newsitems as $item) { $itemsbycategory[$item->getCategory()->toString()][] = $item; } ?>
getCurrently(); $forecast = $weather->getForecast(); ?>

summary; ?>

build("{temp}{units}", ["temp" => round(Weather::convertDegCToUnits($currently->temperature, $tempunits), 1), "units" => " $degreesymbol$tempunits"]); ?>

build("Low: {tempLow}{units} High: {tempHigh}{units}", [ "tempLow" => round(Weather::convertDegCToUnits($forecast[0]->tempLow, $tempunits), 1), "tempHigh" => round(Weather::convertDegCToUnits($forecast[0]->tempHigh, $tempunits), 1), "units" => " $degreesymbol$tempunits" ]); ?>

summary; ?>

= 4) { break; } $i++; ?>
time); ?>

build("{tempLow} to {tempHigh}{units}", [ "tempLow" => round(Weather::convertDegCToUnits($day->tempLow, $tempunits), 1), "tempHigh" => round(Weather::convertDegCToUnits($day->tempHigh, $tempunits), 1), "units" => " $degreesymbol$tempunits" ]); ?>

summary; ?>

get("Headlines"); ?>

= 10) { break; } $count++; echo $item->generateGridCard(true); } ?>