Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv4639
Modified Files:
test.php
Log Message:
More useful test page.
Index: test.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/test.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- test.php 12 May 2002 15:09:30 -0000 1.4
+++ test.php 26 Aug 2002 15:55:53 -0000 1.5
@@ -1,34 +1,62 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>PHPWeather test configuration file</title>
+ <link rel="stylesheet" type="text/css" href="pw_style.css" />
+ <title>PHP Weather - Test Page</title>
</head>
-
<body>
+
+<img src="icons/phpweather-long-white.gif" width="187" height="50"
+alt="PHP Weather" align="right" />
+
+<h1>PHP Weather Test Page</h1>
+
+<p>You can use this page to test a specific METAR report. Enter the
+report below, select a language and see how PHP Weather handles the
+report:</p>
+
<?php
error_reporting(E_ALL);
+/* Load PHP Weather */
require('phpweather.php');
+/* Load utilities to make forms */
require('pw_utilities.php');
-$weather = new phpweather(array());
-$weather->set_metar('RPLL 121400Z 13010KT 9999 FEW025 28/21 Q1011 A 29.86 NOSIG');
+if (empty($language)) $language = 'en';
-$language = "en";
+$weather = new phpweather();
- require(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php");
- require(PHPWEATHER_BASE_DIR . "/output/pw_images.php");
- $type = 'pw_text_' . $language;
- $text = new $type($weather, array());
-
-echo $text->print_pretty() . "<br />\n";
-$icons = new pw_images($weather, array());
-echo '<img src="'.$icons->get_sky_image().'" />';
-echo '<img src="'.$icons->get_winddir_image().'" />';
-echo '<img src="'.$icons->get_temp_image().'" />';
?>
+<form action="test.php" method="GET">
+<p>Metar: <input type="text" name="metar" size="60"
+ value="<?php if (!empty($metar)) echo $metar; ?>"></p>
+<p>Language: <?php echo get_languages_select($weather, $language); ?>
+<input type="submit"></p>
+</form>
+
+<?php
+if (!empty($metar)) {
+
+ $weather->set_metar($metar);
+
+ require(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php");
+ require(PHPWEATHER_BASE_DIR . "/output/pw_images.php");
+
+ $type = 'pw_text_' . $language;
+ $text = new $type($weather);
+
+ echo "<blockquote>\n" . $text->print_pretty() . "</blockquote>\n";
+
+ $icons = new pw_images($weather);
+ echo '<p><img src="'.$icons->get_sky_image().'" /> ';
+ echo '<img src="'.$icons->get_winddir_image().'" /> ';
+ echo '<img src="'.$icons->get_temp_image().'" /></p>';
+}
+
+?>
</body>
</html>
|