cvs: pear /Services_Weather/examples weather.com-extensive.php
| From: | Alexander Wirtz | Date: | Sat, 10 Jul 2004 11:25:08 +0000 |
| Subject: | cvs: pear /Services_Weather/examples weather.com-extensive.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21706@lists.php.net to get a copy of this message | ||
eru Sat Jul 10 07:25:08 2004 EDT
Modified files:
/pear/Services_Weather/examples weather.com-extensive.php
Log:
o Changed handling of units
http://cvs.php.net/diff.php/pear/Services_Weather/examples/weather.com-extensive.php?r1=1.9&r2=1.10&ty=u
Index: pear/Services_Weather/examples/weather.com-extensive.php
diff -u pear/Services_Weather/examples/weather.com-extensive.php:1.9
pear/Services_Weather/examples/weather.com-extensive.php:1.10
--- pear/Services_Weather/examples/weather.com-extensive.php:1.9 Fri Jul 9 23:42:20 2004
+++ pear/Services_Weather/examples/weather.com-extensive.php Sat Jul 10 07:25:08 2004
@@ -16,7 +16,7 @@
// | Authors: Alexander Wirtz <alex@pc4p.net> |
// +----------------------------------------------------------------------+
//
-// $Id: weather.com-extensive.php,v 1.9 2004/07/10 03:42:20 eru Exp $
+// $Id: weather.com-extensive.php,v 1.10 2004/07/10 11:25:08 eru Exp $
/*
* Well, this is a more elaborate example how to create a neat little page
@@ -83,8 +83,12 @@
// something more common...
$weatherDotCom->setUnitsFormat($unitsFormat);
$units = $weatherDotCom->getUnitsFormat();
-$units["temp"] = strtoupper($units["temp"]);
-$units["wind"] = str_replace("kmh", "km/h",
$units["wind"]);
+$units["temp"] = "°".strtoupper($units["temp"]);
+$units["wind"] = " ".str_replace("kmh", "km/h",
$units["wind"]);
+$units["vis"] = " ".$units["vis"];
+$units["height"] = " ".$units["height"];
+$units["pres"] = " ".$units["pres"];
+$units["rain"] = " ".$units["rain"];
// Set date-/time-format
$weatherDotCom->setDateTimeFormat($dateFormat, $timeFormat);
@@ -186,17 +190,17 @@
</td>
</tr>
<tr>
- <td><span class="bold">Temperature:</span>
<?=round($weather["temperature"],
1)?>°<?=$units["temp"]?></td>
- <td><span class="bold">Dew point:</span>
<?=round($weather["dewPoint"],
1)?>°<?=$units["temp"]?></td>
- <td><span class="bold">Felt temperature:</span>
<?=round($weather["feltTemperature"],
1)?>°<?=$units["temp"]?></td>
+ <td><span class="bold">Temperature:</span>
<?=round($weather["temperature"], 1).$units["temp"]?></td>
+ <td><span class="bold">Dew point:</span>
<?=round($weather["dewPoint"], 1).$units["temp"]?></td>
+ <td><span class="bold">Felt temperature:</span>
<?=round($weather["feltTemperature"], 1).$units["temp"]?></td>
</tr>
<tr>
- <td colspan="2"><span
class="bold">Pressure:</span> <?=round($weather["pressure"], 1)?>
<?=$units["pres"]?> and <?=$weather["pressureTrend"]?></td>
+ <td colspan="2"><span
class="bold">Pressure:</span> <?=round($weather["pressure"],
1).$units["pres"]?> and <?=$weather["pressureTrend"]?></td>
<td><span class="bold">Humidity:</span>
<?=$weather["humidity"]?>%</td>
</tr>
<tr>
- <td colspan="2"><span class="bold">Wind:</span>
<?=strtolower($weather["windDirection"]) == "calm" ? "Calm" :
"From the ".$weather["windDirection"]."
(".$weather["windDegrees"]."°) at
".round($weather["wind"], 1)." ".$units["wind"]?></td>
- <td><span class="bold">Visibility:</span>
<?=round($weather["visibility"], 1)?> <?=$units["vis"]?></td>
+ <td colspan="2"><span class="bold">Wind:</span>
<?=strtolower($weather["windDirection"]) == "calm" ? "Calm" :
"From the ".$weather["windDirection"]."
(".$weather["windDegrees"]."°) at
".round($weather["wind"], 1).$units["wind"]?></td>
+ <td><span class="bold">Visibility:</span>
<?=round($weather["visibility"], 1).$units["vis"]?></td>
</tr>
<tr>
<td><span class="bold">Current
condition:</span><br><?=$weather["condition"]?></td>
@@ -256,7 +260,7 @@
<td align="center" colspan="2" style="height:
15px"><span class="bold"><?=$dayname?></span></td>
</tr>
<tr>
- <td align="center" colspan="2" style="height:
45px"><?=$afternoon ? "" : '<span
class="redbold">'.round($forecast["days"][$day]["temperatureHigh"],
0).'°'.$units["temp"].'</span> / '?><span
class="bluebold"><?=round($forecast["days"][$day]["temperatureLow"],
0)?>°<?=$units["temp"]?></span></td>
+ <td align="center" colspan="2" style="height:
45px"><?=$afternoon ? "" : '<span
class="redbold">'.round($forecast["days"][$day]["temperatureHigh"],
0).$units["temp"].'</span> / '?><span
class="bluebold"><?=round($forecast["days"][$day]["temperatureLow"],
0).$units["temp"]?></span></td>
</tr>
<tr>
<td align="center" style="width: 50%; height:
15px"><?=$afternoon ? " " : '<span
class="bold">Day</span>'?></td>
@@ -277,8 +281,8 @@
<td align="center" style="height:
45px"><?=$forecast["days"][$day]["night"]["precipitation"]?>%</td>
</tr>
<tr>
- <td align="center" style="height:
45px"><?=$afternoon ? " " :
round($forecast["days"][$day]["day"]["wind"],
0)." ".$units["wind"]."
from ".$forecast["days"][0]["day"]["windDirection"]?></td>
- <td align="center" style="height:
45px"><?=round($forecast["days"][$day]["night"]["wind"],
0)?> <?=$units["wind"]?>
from <?=$forecast["days"][0]["day"]["windDirection"]?></td>
+ <td align="center" style="height:
45px"><?=$afternoon ? " " :
round($forecast["days"][$day]["day"]["wind"],
0).$units["wind"]."
from ".$forecast["days"][0]["day"]["windDirection"]?></td>
+ <td align="center" style="height:
45px"><?=round($forecast["days"][$day]["night"]["wind"],
0).$units["wind"]?>
from <?=$forecast["days"][0]["day"]["windDirection"]?></td>
</tr>
<tr>
<td align="center" style="height:
15px"><?=$afternoon ? "" :
$forecast["days"][$day]["day"]["humidity"]."%"?></td>