Defaults are not taken
Brought to you by:
iridium
From: Julien C. <jul...@wa...> - 2005-02-21 15:08:58
|
Hi, I installed PHP weather 2.2.2 and it works well, but it doesn't seem to = take the modifications I did in default.php, and I would like to display = metric units only... I want to include the data in a web page, so I started from index.php to customize the page I would include (don't know if thats the way its = meant to be but every other codes to include given in documentation failed). Could you tell me what's wrong? Thanks a lot, Julien Here is my page code: <?php error_reporting(E_ALL); /* We store the time */ $start_time =3D explode(' ', microtime()); require('phpweather.php'); require('pw_utilities.php'); require('default.php'); $weather =3D new phpweather(); $output =3D '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"fr" = lang=3D"fr"> <head> <link rel=3D"stylesheet" type=3D"text/css" href=3D"http://www.julien-carnot.net/blog/themes/jul/style.css" = media=3D"screen" /> <title>M=E9t=E9o</title> </head> <body> <h2>M=E9t=E9o</h2> '; /* We should protect ourself against nasty guys passing quoting * characters to CGI variables. We also want to allow lowercase * icao/cc specification. It should improve direct linking to our * weather website. Someone should directly write * ``http://example.com/weather.php?icao=3Dlztt'' if he or she knows * particular code for airport (icao). */ if (empty($HTTP_GET_VARS['cc'])) { $cc =3D ''; } else { $cc =3D trim(stripslashes($HTTP_GET_VARS['cc'])); } if (empty($HTTP_GET_VARS['icao'])) { $icao =3D ''; } else { $icao =3D trim(stripslashes($HTTP_GET_VARS['icao'])); } $languages =3D get_languages('text'); if (empty($HTTP_GET_VARS['language']) || !in_array($HTTP_GET_VARS['language'], array_keys($languages))) { $language =3D 'en'; } else { $language =3D stripslashes($HTTP_GET_VARS['language']); } if ($icao !=3D '') { $weather->set_icao($icao); /* icao was passed, we resolve country code */ $cc_temp =3D $weather->get_country_code(); if ($cc_temp =3D=3D=3D false) { /* turn icao off, it is not valid */ $icao =3D ''; } else { /* use resolved country code */ $cc =3D $cc_temp; } } if (! empty($icao)) { /* We should only display the current weather if we have station = ($icao) */ require(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php"); $type =3D 'pw_text_' . $language; $text =3D new $type($weather); =20 require(PHPWEATHER_BASE_DIR . "/output/pw_images.php"); $icons =3D new pw_images($weather); =20 $output .=3D=20 $text->print_pretty() .=20 =20 '<p><img src=3D"' . $icons->get_sky_image() . '" height=3D"50" width=3D"80" alt=3D"Current weather in ' . $weather->get_location() . '" /> ' . '<img src=3D"' . $icons->get_winddir_image() . '" height=3D"40" width=3D"40"alt=3D"Current wind in ' . $weather->get_location() . '" /> ' . '<img src=3D"' . $icons->get_temp_image() . '" height=3D"50" width=3D"20" alt=3D"Current temperature in ' = . $weather->get_location() . '" /></p>'; } if (empty($text)) { header('Content-Type: text/html; charset=3DISO-8859-1'); } else { header('Content-Type: text/html; charset=3D' . $text->get_charset()); } echo $output; $end_time =3D explode(' ', microtime()); $diff =3D ($end_time[0] + $end_time[1]) - ($start_time[0] + = $start_time[1]); ?> </body> </html> |