function weather_getReport() { global $weatherTypeList; init_Weathers(); $regions = getRegions(); $template = tmpl_open($_SESSION['player']->getTemplatePath() . 'weather_report.ihtml'); $tmp = true; foreach ($regions as $region) { $tmp = $tmp && $region[weather] == -1; } if ($tmp) { // no weather so far tmpl_set($template, 'CONTENT/NOWEATHER', array('iterate' => '')); return tmpl_parse($template); } $alt = 0; foreach ($regions as $region) { $alt = ($alt + 1) % 2; // alternates between 0 and 1. Couldn't use regionID, they don't need to be adjacent tmpl_iterate($template, 'CONTENT/WEATHER/ROW'); tmpl_set($template, 'CONTENT/WEATHER/ROW', array('region' => $region['name'], 'weather' => $weatherTypeList[$region['weather']]->name, 'alternate' => $alt)); } return tmpl_parse($template); }
* the License, or (at your option) any later version. */ // include necessary files include "util.inc.php"; include INC_DIR . "db.inc.php"; include INC_DIR . "config.inc.php"; include INC_DIR . "basic.lib.php"; include INC_DIR . "time.inc.php"; include INC_DIR . "rules/effects.list.php"; include INC_DIR . "rules/wonder.rules.php"; include INC_DIR . "wonder.inc.php"; // show header weather_showHeader(); // connect to databases $db = DbConnect(); init_Weathers(); // actually do something weather_generate(); // show footer weather_showFooter(); // ***** FUNCTIONS ***** ******************************************************* /** * Logging function with printf syntax */ function weather_log($format) { // get args $args = func_get_args(); // get format string $format = array_shift($args); // do something