assign("title", "Počasí - Tivat");
$smarty->assign("section", "weather");
$path[] = array("url" => "http://www.cernahora.info/", "title" => "Černá Hora");
$path[] = array("url" => "http://www.cernahora.info/pocasi/", "title" => "Počasí");
$path[] = array("url" => "http://www.cernahora.info/pocasi/tivat/", "title" => "Tivat");
$smarty->assign('path',$path);
$smarty->assign('img',$img);
$smarty->assign('city','Tivat');
$file = "./weather/tivat-today.xml";
$objDOM = new DOMDocument();
$objDOM->load($file);
$lsup = $objDOM->getElementsByTagName("lsup");
$tmp = $objDOM->getElementsByTagName("tmp");
$s = $objDOM->getElementsByTagName("s");
$t = $objDOM->getElementsByTagName("t");
$hmid = $objDOM->getElementsByTagName("hmid");
$vis = $objDOM->getElementsByTagName("vis");
$icon = $objDOM->getElementsByTagName("icon");
$smarty->assign('lsup', $lsup->item(0)->nodeValue);
$smarty->assign('icon', $icon->item(0)->nodeValue);
$smarty->assign('t', $t->item(4)->nodeValue);
$smarty->assign('hmid', $hmid->item(0)->nodeValue);
$smarty->assign('vis', round(($vis->item(0)->nodeValue)*1.611, 2));
$smarty->assign('temp', round(($tmp->item(0)->nodeValue - 32)*5/9));
$smarty->assign('wind_spd', round(($s->item(0)->nodeValue)*1.611, 1));
$smarty->assign('wind_dir', $t->item(5)->nodeValue);
$file = "./weather/tivat-forecast.xml";
$objDOM = new DOMDocument();
$objDOM->load($file);
$at = $objDOM->getElementsByTagName("day");
$dt = $objDOM->getElementsByTagName("day");
$t = $objDOM->getElementsByTagName("t");
$hi = $objDOM->getElementsByTagName("hi");
$low = $objDOM->getElementsByTagName("low");
$ppcp = $objDOM->getElementsByTagName("ppcp");
$icon = $objDOM->getElementsByTagName("icon");
$smarty->assign('at1', getAt(time() + 3600*24));
$smarty->assign('dt1', $dt->item(1)->getAttribute("dt"));
$smarty->assign('t1', $t->item(8)->nodeValue);
$smarty->assign('hi1', round(($hi->item(1)->nodeValue - 32)*5/9));
$smarty->assign('low1', round(($low->item(1)->nodeValue - 32)*5/9));
$smarty->assign('ppcp1', $ppcp->item(2)->nodeValue);
$smarty->assign('icon1', $icon->item(2)->nodeValue);
$smarty->assign('at2', getAt(time() + 3600*24*2));
$smarty->assign('dt2', $dt->item(2)->getAttribute("dt"));
$smarty->assign('t2', $t->item(12)->nodeValue);
$smarty->assign('hi2', round(($hi->item(2)->nodeValue - 32)*5/9));
$smarty->assign('low2', round(($low->item(2)->nodeValue - 32)*5/9));
$smarty->assign('ppcp2', $ppcp->item(4)->nodeValue);
$smarty->assign('icon2', $icon->item(4)->nodeValue);
$smarty->assign('at3', getAt(time() + 3600*24*3));
$smarty->assign('dt3', $dt->item(3)->getAttribute("dt"));
$smarty->assign('t3', $t->item(16)->nodeValue);
$smarty->assign('hi3', round(($hi->item(3)->nodeValue - 32)*5/9));
$smarty->assign('low3', round(($low->item(3)->nodeValue - 32)*5/9));
$smarty->assign('ppcp3', $ppcp->item(6)->nodeValue);
$smarty->assign('icon3', $icon->item(6)->nodeValue);
$smarty->assign('at4', getAt(time() + 3600*24*4));
$smarty->assign('dt4', $dt->item(4)->getAttribute("dt"));
$smarty->assign('t4', $t->item(20)->nodeValue);
$smarty->assign('hi4', round(($hi->item(4)->nodeValue - 32)*5/9));
$smarty->assign('low4', round(($low->item(4)->nodeValue - 32)*5/9));
$smarty->assign('ppcp4', $ppcp->item(8)->nodeValue);
$smarty->assign('icon4', $icon->item(8)->nodeValue);
function getAt($ts) {
$days = array("Pondelí", "Uterí", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle");
return "".$days[(date(N, $ts) - 1)]."
".date("j. n.", $ts);
}
require './includes/vacation.inc.php';
$content = $smarty->fetch('weather_city.tpl');
$smarty->assign('content',$content);
$smarty->display('master_page.tpl');
?>