CVS: phpweather-1.x demo.php,1.3,1.4
Brought to you by:
iridium
|
From: Martin G. <gim...@us...> - 2002-04-19 18:27:45
|
Update of /cvsroot/phpweather/phpweather-1.x
In directory usw-pr-cvs1:/tmp/cvs-serv11593
Modified Files:
demo.php
Log Message:
Added a small description of the icons with a link to table.php.
Index: demo.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather-1.x/demo.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- demo.php 19 Apr 2002 18:13:44 -0000 1.3
+++ demo.php 19 Apr 2002 18:27:42 -0000 1.4
@@ -11,6 +11,7 @@
include('locale_en.inc');
include('phpweather.inc');
+include('images.inc');
?>
@@ -34,9 +35,9 @@
for, decoding a METAR into plain-text, so you can use for something
useful.</p>
-<h1>Your version: <? echo $version ?></h1>
+<h1>Your version: <?php echo $version ?></h1>
-<p>Your source was last modified on <b><? echo $last_modified ?></b>.
+<p>Your source was last modified on <b><?php echo $last_modified ?></b>.
Click <a href="http://sourceforge.net/projects/phpweather/">here</a>
to download the newest version from <a
href="http://www.sourceforge.net/">SourceForge</a>. I'm currently
@@ -71,7 +72,7 @@
<?php $metar = get_metar('EKAH'); ?>
-<blockquote><code><? echo $metar ?></code></blockquote>
+<blockquote><code><?php echo $metar ?></code></blockquote>
<p>Not exactly a pretty sight? Well by using <a
href="http://sourceforge.net/projects/phpweather/">PHP Weather</a> you
@@ -81,11 +82,18 @@
pretty_print_metar($metar, 'Tirstrup, Denmark')
?>
+<blockquote>
+<?php $decoded_metar = process_metar($metar); ?>
+<img src="<?php get_temp_image($decoded_metar) ?>" height="50" width="20" border="1">
+<img src="<?php get_winddir_image($decoded_metar) ?>" height="40" width="40" border="1">
+<img src="<?php get_sky_image($decoded_metar) ?>" height="50" width="80" border="1">
+</blockquote>
+
<p>Here is the same piece of text with the current weather in
Honolulu, Hawaii. This time the information is presented in Spanish.
First comes the raw METAR:</p>
-<blockquote><code><? echo $metar = get_metar('PHNL') ?></code></blockquote>
+<blockquote><code><?php echo $metar = get_metar('PHNL') ?></code></blockquote>
<p>and then the pretty-printed output:</p>
@@ -93,6 +101,12 @@
include('locale_es.inc');
pretty_print_metar($metar, 'Honolulu, Hawaii');
?>
+<blockquote>
+<?php $decoded_metar = process_metar($metar); ?>
+<img src="<?php get_temp_image($decoded_metar) ?>" height="50" width="20" border="1">
+<img src="<?php get_winddir_image($decoded_metar) ?>" height="40" width="40" border="1">
+<img src="<?php get_sky_image($decoded_metar) ?>" height="50" width="80" border="1">
+</blockquote>
<p>The only thing I changed between the two pieces of code was the
identifier of the weather station, and the include-file with the
@@ -107,7 +121,7 @@
<form action="demo.php" method="post">
<select name="city" onChange="this.form.submit()">
-<?
+<?php
$cities = array(
'BGTL' => 'Thule A. B., Greenland',
@@ -175,8 +189,14 @@
$metar = get_metar($city);
include('locale_' . $language . '.inc');
pretty_print_metar($metar, $cities[$city]) ?>
-<p>The METAR for <? echo $cities[$city] ?>, presented in <? echo $languages[$language] ?>, was:</p>
-<blockquote><code><? echo $metar ?></code></blockquote>
+<blockquote>
+<?php $decoded_metar = process_metar($metar); ?>
+<img src="<?php get_temp_image($decoded_metar) ?>" height="50" width="20" border="1">
+<img src="<?php get_winddir_image($decoded_metar) ?>" height="40" width="40" border="1">
+<img src="<?php get_sky_image($decoded_metar) ?>" height="50" width="80" border="1">
+</blockquote>
+<p>The METAR for <?php echo $cities[$city] ?>, presented in <?php echo $languages[$language] ?>, was:</p>
+<blockquote><code><?php echo $metar ?></code></blockquote>
<h1>Using PHP Weather</h1>
@@ -208,6 +228,18 @@
</font>
</code>
+<p>To get matching icons you'll use the functions
+<code>get_temp_image($data)</code>,
+<code>get_winddir_image($data)</code>, and
+<code>get_sky_image($code)</code> like this:</p>
+
+<code><font color="#000000">
+<blockquote><br /><font color="#0000CC"><?php $decoded_metar </font><font color="#006600">= </font><font color="#0000CC">process_metar</font><font color="#006600">(</font><font color="#0000CC">$metar</font><font color="#006600">); </font><font color="#0000CC">?><br /></font><img src="<font color="#0000CC"><?php get_temp_image</font><font color="#006600">(</font><font color="#0000CC">$decoded_metar</font><font color="#006600">) </font><font color="#0000CC">?></font>" height="50" width="20" border="1">&nbsp;<br /><img src="<font color="#0000CC"><?php get_winddir_image</font><font color="#006600">(</font><font color="#0000CC">$decoded_metar</font><font color="#006600">) </font><font color="#0000CC">?></font>" height="40" width="40" border="1"><br /><img src="<font color="#0000CC"><?php get_sky_image</font><font color="#006600">(</font><font color="#0000CC">$decoded_metar</font><font color="#006600">) </font><font color="#0000CC">?></font>" height="50" width="80" border="1">&nbsp;<br /></blockquote><br /></font>
+</code>
+
+<p>Please refer to <a href="table.php">this document</a> for more
+information about how to use these functions.</p>
+
<p>If you wan't to see all the data in the METAR, then try the following code:</p>
<code><font color="#000000">
@@ -328,7 +360,7 @@
<code>wap.php</code>-page is a smaller and more compact format than
the one shown on this page. It looks like this:</p>
-<pre><? pretty_print_metar_wap(get_metar('EKAH'), 'Tirstrup'); ?></pre>
+<pre><?php pretty_print_metar_wap(get_metar('EKAH'), 'Tirstrup'); ?></pre>
<h1>Related information</h1>
|