I hope I have sorted out the skewed UV dates and values displayed in the evening after dark. These code additions are working right now, and I'm waiting to see what will happen after midnight. I added an $evening variable which is subtracted from the $UVptr that indexes the day during the UV prediction data access. This prevents the skew that $UVptr++ produces before midnight after dark.
<?php } else { // don't have UV sensor or it's dark .. show UV forecast instead ?>
<?php
if ($haveUV) { // Show todays high if evening or yesterdays high if morning
$evening=0; // Need to adjust forecasts if it's before Midnight after dark
if ($time_hour>12) { // because the forecasts points at wrong day otherwise
$evening=1; // and forecast isn't for 'tomorrow'.
}
?>
<tr>
<td align="center" colspan="3" nowrap="nowrap" class="data2" style="text-align: center; font-size: 10px;">
<?php if ($time_hour > 12) { // Display Summary if in the evening ?>
<?php langtrans('High Today'); ?>: <span style="font-size: 9px;">
<?php echo $highuv; ?> @ <?php echo $highuvtime; ?></span>
<?php $UVptr++; // increment counter if it's evening ?>
<?php } else { ?>
<?php langtrans('High Yest'); ?>: <span style="font-size: 9px;">
<?php echo $highuvyest; ?> @ <?php echo $highuvyesttime; ?></span>
<?php } ?>
</td>
</tr>
<?php } ?>
<tr>
<td align="center" width="35%" nowrap="nowrap" class="data2" style="text-align: center; font-size: 9px;">
<?php $UVshortdate = mktime(0,0,0,date("m"), date(d)+$UVptr, date("y")); ?>
<?php echo date("M-d",$UVshortdate) ?><br/>
<img src="/ajax-images/uv<?php echo round($UVfcstUVI[$UVptr-$evening],0); ?>.gif" height="45" width="34" alt="" title="Predicted UV rate" /><br/>
<b><a href="<?php echo htmlspecialchars($UV_URL); ?>" title="<?php echo strip_tags($requiredNote); ?>"><?php echo $UVfcstUVI[$UVptr]; ?></a></b>
<?php $UVptr++; // increment counter ?>
</td>
<td align="center" width="30%" class="data2" nowrap="nowrap" style="text-align: center; font-size: 9px;">
<?php $UVshortdate = mktime(0,0,0,date("m"), date(d)+$UVptr, date("y")); ?>
<?php echo date("M-d",$UVshortdate) ?><br/>
<img src="/ajax-images/uv<?php echo round($UVfcstUVI[$UVptr-$evening],0); ?>.gif" height="45" width="34" alt="" title="Predicted UV rate" /><br/>
<b><a href="<?php echo htmlspecialchars($UV_URL); ?>" title="<?php echo strip_tags($requiredNote); ?>"><?php echo $UVfcstUVI[$UVptr]; ?></a></b>
<?php $UVptr++; // increment counter ?>
</td>
<td align="center" width="35%" class="data2" nowrap="nowrap" style="text-align: center; font-size: 9px;">
<?php $UVshortdate = mktime(0,0,0,date("m"), date(d)+$UVptr, date("y")); ?>
<?php echo date("M-d",$UVshortdate) ?><br/>
<img src="/ajax-images/uv<?php echo round($UVfcstUVI[$UVptr-$evening],0); ?>.gif" height="45" width="34" alt="" title="Predicted UV rate" /><br/>
<b><a href="<?php echo htmlspecialchars($UV_URL); ?>" title="<?php echo strip_tags($requiredNote); ?>"><?php echo $UVfcstUVI[$UVptr]; ?></a></b>
<?php $UVptr++; // increment counter ?>
</td>
</tr>
<?php //$UVptr++; // increment counter ?>
<?php } // end $haveUV ---------------------------------------- ?>
I'm waiting to see what happens after midnight.
I also just checked my ajax-images directory and I see that my single integer uppercase UV images don't have leading zeros whereas my lowercase images do. Does the script look for leading zeros, Scott?
The mods have passed the midnight test. Today's (June 3rd) UV forecast is still correctly listed as the first one displayed, and it's value/icon is correct.