Hi Jeanette,
Your page was missing a couple of things. The fatal error was caused by a misplaced (by me) function definition, and by your site not having a get-UV-forecast-inc.php and ./UVimages/ directory (in attached .zip).
<?php
//------------------------------------------------
include("./wdlive/testtags2.php");
?>
<?php
$ourTZ = "America/Phoenix";
$maxIcons = 7; // maximum number of icons to display
// overrides from Settings.php if available
global $SITE;
if (isset($SITE['tz'])) {$ourTZ = $SITE['tz'];}
// end of overrides from Settings.php if available
if (! isset($UVfcstDate[0])) { // load up the UV forecast script
$UVfcstDate = array_fill(0,9,''); // initialize the return arrays
$UVfcstUVI = array_fill(0,9,'n/a');
}
include_once("get-UV-forecast-inc.php");
$maxIcons = min($maxIcons,count($UVfcstUVI)); // use lesser of number of icons available
# Set timezone in PHP5/PHP4 manner
if (!function_exists('date_default_timezone_set')) {
if (! ini_get('safe_mode') ) {
putenv("TZ=$ourTZ"); // set our timezone for 'as of' date on file
}
} else {
date_default_timezone_set("$ourTZ");
}
if(!function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- site specific <head></head><body> stuff here -->
<head>
<title>Pepper Ridge North Valley, Phoenix, Az - UV Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Refresh" content="300" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<h1 id="pageName">UV Index Information Page - Be SunWise </h1>
<div class="story">
<table width="100%">
<tr>
<td align="center" valign="middle"><table cellpadding="3" cellspacing="1" style="border: solid 2px #0066FF; font: bold 10pt Arial, Helvetica, sans-serif;
color:#800080;" bgcolor="#EEE8AA">
<tr align="left">
<td class="indxData10"><b>Current UV Index:</b></td>
<td align="left" class="indxData10"><?php echo $VPuv; ?> @ <?php echo date('g:ia' , strtotime($time)); ?> </td>
<td><? echo get_UVrange_code( $VPuv ); ?></td>
</tr>
<?php
if ($burntime <> '---') {
print "<tr align=\"left\"><td>Estimated time to sunburn<sup>1</sup></td><td>$burntime minutes</td><td> </td></tr>\n";
}
?>
<tr align="left" bgcolor="#EEE8AA">
<td class="indxData10">Today's High:</td>
<td align="left" class="indxData10"><?php echo $highuv; ?> @ <?php echo date('g:ia' , strtotime($highuvtime)); ?> </td>
<td><? echo get_UVrange_code( $highuv ); ?></td>
</tr>
<tr align="left" bgcolor="#EEE8AA">
<td class="indxData10">Yesterday's High:</td>
<td align="left" class="indxData10"><?php echo $highuvyest; ?> @ <?php echo date('g:ia' , strtotime($highuvyesttime)); ?> </td>
<td><? echo get_UVrange_code( $highuvyest ); ?></td>
</tr>
</table>
<table>
<tr align="center">
<th colspan="4"><br/>UV index Forecast</th>
</tr>
<tr align="center">
<td><?php echo date('D',strtotime($UVfcstDate[0])); ?></td>
<td><?php echo date('D',strtotime($UVfcstDate[1])); ?></td>
<td><?php echo date('D',strtotime($UVfcstDate[2])); ?></td>
<td><?php echo date('D',strtotime($UVfcstDate[3])); ?></td>
</tr>
<tr align="center">
<td><?php echo gen_uv_icon($UVfcstUVI[0]); ?></td>
<td><?php echo gen_uv_icon($UVfcstUVI[1]); ?></td>
<td><?php echo gen_uv_icon($UVfcstUVI[2]); ?></td>
<td><?php echo gen_uv_icon($UVfcstUVI[3]); ?></td>
</tr>
<tr align="center">
<td><?php echo $UVfcstUVI[0]; ?></td>
<td><?php echo $UVfcstUVI[1]; ?></td>
<td><?php echo $UVfcstUVI[2]; ?></td>
<td><?php echo $UVfcstUVI[3]; ?></td>
</tr>
<tr align="center">
<td><?php echo get_uv_word(round($UVfcstUVI[0],0)); ?></td>
<td><?php echo get_uv_word(round($UVfcstUVI[1],0)); ?></td>
<td><?php echo get_uv_word(round($UVfcstUVI[2],0)); ?></td>
<td><?php echo get_uv_word(round($UVfcstUVI[3],0)); ?></td>
</tr>
<tr>
<td colspan="4" style="text-align: center;"><small><?php print $requiredNote; ?></small></td>
</tr>
</table>
</td>
<td align="right" valign="top">
<img src="./Photos/uv_image.jpg" alt="UV Index Scale" title="UV Index Scale" width="330" height="277"
/>
</td>
</tr>
<?php
if ($burntime <> '---') {
print "<tr><td colspan=\"2\"><small><sup>1</sup>Estimated time in minutes to sunburn normal skin at the current UV rate.</small></td></tr>\n";
}
?>
</table>
<table width="100%" style="border: none; " cellpadding="0" cellspacing="2" >
<tr>
<th>UV index Forecast</th>
<th>UV index Last 5 days and forecast</th>
</tr>
<tr>
<td>
<div align="center"><img src="http://icons.wunderground.com/data/images/sw_uv.gif" align="center" alt="UV forecast map"
title="UV Forecast" width="320" height="240" /></div></td>
<td><div align="center"><img src="http://icons.wunderground.com/data/640x480/sw_uv_anim.gif" align="center" alt="UV Forecast Animation"
title="UV Forecast Animation" width="320" height="240" /></div></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td align="center">
</td></tr></table>
<table width="100%" border="0">
<tr><th align="center">Solar Radiation - last 72 hours</th><th align="center">UV index - last 72 hours</th></tr>
<tr>
<td align="center"><img src="./data2/SolarRadHistory.gif" alt="Graph of last 72 hours Solar Radiation" title="Graph of last 72 hours Solar Radiation" width="320" height="200" /></td>
<td align="center"><img src="./data2/UVHistory.gif" alt="Graph of last 72 hours UV Index" title="Graph of last 72 hours UV Index" width="320" height="200" /></td>
</tr>
</table>
</div>
<div class="story" align="left" cellpadding="5px" style="margin-left: 25px;">
<h2>What is the UV Index?</h2>
<p>Some exposure to sunlight can be enjoyable; however, too much could be dangerous. Overexposure to the sun's ultraviolet (UV) radiation can cause immediate effects such as sunburn and long-term problems such as skin cancer and cataracts. The UV Index, which was developed by the National Weather Service and the U.S. Environmental Protection Agency (EPA), provides important information to help you plan your outdoor activities to prevent overexposure to the sun's rays. </p>
<p>The UV Index provides an indicator of the expected risk of overexposure to the sun. The Index measures UV intensity levels on a scale of 1 to 11+, where low indicates a minimal risk of overexposure and 11+ means an extreme risk. The UV Index takes into account clouds and other local conditions that affect the amount of UV radiation reaching the ground. </p>
<p>By taking a few simple precautions, you can greatly reduce your risk of sun-related illnesses. To <a href="http://www.epa.gov/sunwise/index.html"target="_blank">Be SunWise</a>, consider the following steps: </p>
<ul>
<li>Limit your time in the sun between 10 a.m. and 4 p.m. <br />
</li>
<li>Whenever possible, seek shade. <br />
</li>
<li>Use a broad spectrum sunscreen with an SPF of at least 15. <br />
</li>
<li>Wear a wide-brimmed hat and if possible, tightly woven, full-length clothing. <br />
</li>
<li>Wear UV-protective sunglasses. <br />
</li>
<li>Watch the daily UV Index. <br />
</li>
</ul>
<p>While you should always take precautions against overexposure to the sun, please take special care to adopt the safeguards when the UV Index indicates levels of moderate or above. </p>
<p> </p>
<p>Sources of data:<br />
UV Index forecast from <a href="http://www.weather.gov/view/national.php?prodtype=ultraviolet">NOAA/EPA</a><br />
UV Index maps from <a href="http://www.wunderground.com/US/Region/SW/UVForecast.html">WeatherUnderground</a><br />
Actual UV index readings/graph data from UV sensor on Davis Vantage Pro Plus weather station</p>
<p>Thanks to Ken at <a href="http://www.capitolaweather.net/">CapitolaWeather.net</a> for the text and inspiration for this page.</p>
</div>
</div>
<!--end content -->
<?php
function get_UVrange_code ( $uv ) {
// figure out a text value for UV exposure
// 0 to 2 Low
// 3 to 5 Moderate
// 6 to 7 High
// 8 to 10 Very High
// 11+ Extreme
switch (TRUE) {
case ($uv == 0):
$uv = 'None';
break;
case (($uv > 0) and ($uv < 3)):
$uv = '<span style="border: solid 1px; background-color: #A4CE6a;"> Low </span>';
break;
case (($uv >= 3) and ($uv < 6)):
$uv = '<span style="border: solid 1px;background-color: #FBEE09;"> Medium </span>';
break;
case (($uv >=6 ) and ($uv < 8)):
$uv = '<span style="border: solid 1px; background-color: #FD9125;"> High </span>';
break;
case (($uv >=8 ) and ($uv < 11)):
$uv = '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;"> Very High </span>';
break;
case (($uv > 11) ):
$uv = '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;"> Extreme </span>';
break;
} // end switch
return $uv;
} // end get_uv_range
function get_UVcolor ( $uv ) {
// figure out a color value for UV exposure
// 0 to 2 Low
// 3 to 5 Moderate
// 6 to 7 High
// 8 to 10 Very High
// 11+ Extreme
switch (TRUE) {
case ($uv == 0):
$uv = '#FFFFFF';
break;
case (($uv > 0) and ($uv < 3)):
$uv = '#A4CE6a';
break;
case (($uv >= 3) and ($uv < 6)):
$uv = '#FBEE09';
break;
case (($uv >=6 ) and ($uv < 8)):
$uv = '#FD9125';
break;
case (($uv >=8 ) and ($uv < 11)):
$uv = '#F63F37';
break;
case (($uv > 11) ):
$uv = '#807780';
break;
} // end switch
return $uv;
} // end get_uv_color
?>
<?php
function gen_uv_icon($uv) {
global $SITE;
if($uv == 'n/a') { return( ''); }
$ourUVrounded = round($uv,0);
if ($ourUVrounded > 11) {$ourUVrounded = 11; }
if ($ourUVrounded < 1 ) {$ourUVrounded = 1; }
$ourUVicon = "uv" . sprintf("%02d",$ourUVrounded) . ".gif";
return( '<img src="./UV-images/'.$SITE['imagesDir']. $ourUVicon .
'" height="76" width="40" alt="UV Index" title="UV Index" />');
}
//=========================================================================
// decode UV to word+color for display
function get_uv_word ( $uv ) {
global $SITE;
// figure out a text value and color for UV exposure text
// 0 to 2 Low
// 3 to 5 Moderate
// 6 to 7 High
// 8 to 10 Very High
// 11+ Extreme
switch (TRUE) {
case ($uv == 'n/a'):
$uv = '';
break;
case ($uv == 0):
$uv = langtransstr('None');
break;
case (($uv > 0) and ($uv < 3)):
$uv = '<span style="border: solid 1px; background-color: #A4CE6a;"> '.langtransstr('Low').' </span>';
break;
case (($uv >= 3) and ($uv < 6)):
$uv = '<span style="border: solid 1px;background-color: #FBEE09;"> '.langtransstr('Medium').' </span>';
break;
case (($uv >=6 ) and ($uv < 8)):
$uv = '<span style="border: solid 1px; background-color: #FD9125;"> '.langtransstr('High').' </span>';
break;
case (($uv >=8 ) and ($uv < 11)):
$uv = '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;"> '.langtransstr('Very High').' </span>';
break;
case (($uv >= 11) ):
$uv = '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;"> '.langtransstr('Extreme').' </span>';
break;
} // end switch
return $uv;
} // end getUVword
?>
<!-- site specific footer, </body></html> -->
</body>
</html>
Best regards,
Ken