Author Topic: USA Extremes  (Read 19179 times)

0 Members and 1 Guest are viewing this topic.

Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: USA Extremes
« Reply #75 on: February 13, 2014, 01:50:40 PM »
Than you Saunookweather and Jerry. Since I use the style settings I decided to use the suggestion by Jerry.

It is working great.

Thank you for your help.

Bob
Bob
KK4QXH

Offline Saunookweather

  • Member
  • *
  • Posts: 26
    • Saunookweather
Re: USA Extremes
« Reply #76 on: February 13, 2014, 03:14:46 PM »
I like Jerry's also. Used his on my site.
Thanks Jerry for sharing.

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: USA Extremes
« Reply #77 on: February 13, 2014, 05:10:38 PM »
Thanks for the tips, everybody. Nicely done!
John
W7JKG

Offline MackerelSky

  • Contributor
  • ***
  • Posts: 113
    • McKean County Weather, Smethport Pa.
Re: USA Extremes
« Reply #78 on: February 13, 2014, 06:22:33 PM »

Is there a way to reduce the amount of space from the section above to where it says weather extremes? Looks like weather extremes starts two lines down from the previous section adding to the background space?

Finally since there is world high and low temperature can the world high rain be added?

Again thank you.

Bob


Hi Bob,

Second question first.. If you look at the page again http://www.wunderground.com/climate/extremes.asp you'll see we have 'taken' all of the info available for that puppy as far as I can see.

On your first question, and I don't propose to be a 'coder', the extra spaces that were occurring were because all of the data was being put into 'p' tags, or what I understand to be 'paragragh' tags.

Code: [Select]
<p align="center" style="font-size:100%; font-weight:bold; color:#181008">Past 24 Hours</p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#F00"><span class="style8">USA High:</span>&nbsp;<?php echo $usahigh ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#F00"><span class="style9">USA High Heat Index:</span>&nbsp;<?php echo $usaheatIndex ?></p>
That 'p align center' and then the ending p tag '/p'. This, again to me, means that you are putting a blank line basically above and below the data...

I use css for displaying my extremes data and incase someone wants to experiment, I've set up a simple page to show how css could fit into your menubar if you chose to do so.

http://www.mckeanweather.com/wxextremestestcss.php

What this consists of is basically a css file into the head of your page and the 'div' code entered into your menubar or any other location you wish.

Head
Code: [Select]
<style>
.wxextremes
{padding: 3px 3px 3px 3px;
 width: 110px;
 background: #FAF7F8;
 color: #000000;
 font-size: 1em;
 text-align: center ;
 border:2px solid red;
 border-radius:10px 10px 10px 10px;
 box-shadow: 5px 5px 5px #888888;
}
.xtremebl {color: blue;} /* add some colors to your spans*/
.xtremerd {color: red;}
.xtremegr {color: green;}
.xtremeye {color: yellow;}
.xtremebla {color: black;}
</style>

I set this up with the width of 110px, the same width of Jerrys table, so it should fit inside the menubar. If not you can size to suit. It also gives you some color options, rounded corners, etc. to play(and learn) with.

Then put this into the menbar

Code: [Select]
<div class="wxextremes">
<?php include_once('extremes.php')?>       
24 Hour Extremes<br/>US and World<br/>-------------------<br/>
    <span class="xtremebla"><b> High Temp</b></span><br/><span class="xtremebl"><?php echo $usahigh ?> </span> <br/>****<br/>
     <span class="xtremebla"><b>High Heat Index</b></span> <span class="xtremerd"><?php echo $usaheatIndex ?> </span> <br/>****<br/>
     <span class="xtremebla"><b>Low Temp</b><br/></span> <span class="xtremebl"><?php echo $usalow ?> </span> <br/> **** <br/>
     <span class="xtremebla"><b>Low Wind Chill</b></span> <span class="xtremerd"><?php echo $usawindChill ?> </span> <br/> **** <br/>
     <span class="xtremebla"><b>High Wind Gust</b></span> <span class="xtremebl"><?php echo $usawind ?>  </span>  <br/> **** <br/>
     <span class="xtremebla"><b>High Rainfall</b></span> <span class="xtremerd"><?php echo $usaprecip ?>  </span> <br/> **** <br/>------------------<br/>
     <span class="xtremebla"><b>World High Temp</b></span> <span class="xtremebl"><?php echo $worldhigh ?> </span> <br/>****<br/>
     <span class="xtremebla"><b>World Low Temp</b></span> <span class="xtremerd"><?php echo $worldlow ?> </span> <br/>****<br/>
         <small> Data from WeatherUnderground</small>
   </div>   

Like I said, I'm not a coder but it could give your page a little 'personalized' look.
Let me know if there's any problems with the coding

Brad
Mckean County Weather
Located on upper Marvin Creek
https://mckeanweather.com/
Davis VP2 + fars
Cumulus 1.9.4-b1092

 

Offline Cienega32

  • Forecaster
  • *****
  • Posts: 2635
    • East Mesa Weather
Re: USA Extremes
« Reply #79 on: February 22, 2014, 02:30:55 PM »
Another thing I've noticed since using the Wind is that, from time to time, WU would have dupes in their table as well. I ended up redoing the wind code for that and putting together a quick ReadMe for the way I use it.


Finally came across the dupe entries with Mt Wash being first but not highest wind value.

My site server runs PHP 5.2.17 but my RapdPHP runs 5.4.9. I never checked or included any sort code for less than PHP 5.3. Checking the PHP using an 'if else' to choose crashed the script for me so I needed to run one or the other.

 Simple copy & paste and comment or uncomment for either environments (Zip updated):

Code: [Select]
// NO DUPES IN ARRAY AT THIS POINT ********************************
// print "<pre>\n".print_r($matches,true)."</pre>\n<br />";

//echo phpversion();

// Reorder by wind speed if needed (PHP 5.3+)
//    usort($matches, function($a, $b) {
//    return $b[2] - $a[2];
//    });

// print "<pre>\n".print_r($matches,true)."</pre>\n<br />";

// Reorder by wind speed if needed (before PHP 5.3)
   function sortByOrder($a, $b) {
     return $b[2] - $a[2];
     }
    usort($matches, 'sortByOrder');

// print "<pre>\n".print_r($matches,true)."</pre>\n<br />";

// Check and skip Mt Wash if first (overly common)
« Last Edit: February 22, 2014, 02:35:08 PM by Cienega32 »

Pat ~ Davis VP2 6153-Weatherlink-Weather Display-StartWatch-VirtualVP-Win7 Pro-64bit
www.LasCruces-Weather.com   www.EastMesaWeather.com