Author Topic: USA Extremes  (Read 19178 times)

0 Members and 1 Guest are viewing this topic.

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: USA Extremes
« Reply #25 on: September 22, 2012, 09:32:38 AM »
Thanks very much for the WU-based code, Ken.  It's well-designed and works.

We now have 3 possible sources for USA Extremes, all of which currently yield differing results:  AccuWeather via Jim's code snippet, OGIMET via worldextremesGadget.php, and WU via Ken's usaextremes.php.

This just goes to show how data, and therefore 'facts', can be biased, albeit unknowingly, by data availability and by selection criteria.  My dilemma is which one is 'accurate' and therefore is the one I should use.  I suppose the AccuWeather code is least useful since it isn't cached and thus hits their server with each page load.  The OGIMET-based code agrees with the 'World Extremes' data that some of us display, but the WU-based code may give us better results.

I'm using Ken's code at the moment.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: USA Extremes
« Reply #26 on: September 22, 2012, 11:32:54 AM »
Mines is not showing data. Still showing N/A. How do I force?
« Last Edit: September 22, 2012, 11:39:09 AM by hayskswx »




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: USA Extremes
« Reply #27 on: September 22, 2012, 11:53:57 AM »
Mines is not showing data. Still showing N/A. How do I force?

Enter 'usaextremes.php?force=1' on your website's url.

Here is my code for displaying the Extremes in the Menubar:
Code: [Select]
<!-- US Extremes -->
<p class="sideBarTitle"><?php langtrans('US Extremes'); ?></p>
<!-- Weather Underground -->
<?php include_once('usaextremes.php')?>
<p align="center" style="font-size:100%; font-weight:lighter; color:#C96">Past 24 Hours</p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#F00">USA High:&nbsp;<?php echo $usahigh ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#6CF">USA Low:&nbsp;<?php echo $usalow ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#999">Max Precip:&nbsp;<?php echo $usaprecip ?></p>
<!--- end US Extremes -->
The colors I'm using are arbitrary at best.  And, yes, CSS would be neater.
« Last Edit: September 22, 2012, 11:57:08 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline William Grimsley

  • Forecaster
  • *****
  • Posts: 1103
    • Newton Poppleford Weather
Re: USA Extremes
« Reply #28 on: September 22, 2012, 12:01:44 PM »
Mines is not showing data. Still showing N/A. How do I force?

Enter 'usaextremes.php?force=1' on your website's url.

Here is my code for displaying the Extremes in the Menubar:
Code: [Select]
<!-- US Extremes -->
<p class="sideBarTitle"><?php langtrans('US Extremes'); ?></p>
<!-- Weather Underground -->
<?php include_once('usaextremes.php')?>
<p align="center" style="font-size:100%; font-weight:lighter; color:#C96">Past 24 Hours</p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#F00">USA High:&nbsp;<?php echo $usahigh ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#6CF">USA Low:&nbsp;<?php echo $usalow ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#999">Max Precip:&nbsp;<?php echo $usaprecip ?></p>
<!--- end US Extremes -->
The colors I'm using are arbitrary at best.  And, yes, CSS would be neater.

Looks like he doesn't have 'usaextremes.php' on his server. :/

Will
http://www.newton-poppleford-weather.co.uk
Davis Vantage Vue - Cumulus v1.9.4 (1084)
Weather Underground: IDEVONEX12
Met Office WOW: 717144
PWS Weather: ENG128597

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: USA Extremes
« Reply #29 on: September 22, 2012, 02:25:54 PM »
Thanks Jerry! I got it working. Turns out I didn't have to do a force. :grin:




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline Dr Obbins

  • Forecaster
  • *****
  • Posts: 1152
Re: USA Extremes
« Reply #30 on: September 22, 2012, 03:26:21 PM »
Thanks Jerry! I got it working. Turns out I didn't have to do a force. :grin:

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: USA Extremes
« Reply #31 on: September 22, 2012, 07:25:22 PM »
Mines is not showing data. Still showing N/A. How do I force?

Enter 'usaextremes.php?force=1' on your website's url.

Here is my code for displaying the Extremes in the Menubar:
Code: [Select]
<!-- US Extremes -->
<p class="sideBarTitle"><?php langtrans('US Extremes'); ?></p>
<!-- Weather Underground -->
<?php include_once('usaextremes.php')?>
<p align="center" style="font-size:100%; font-weight:lighter; color:#C96">Past 24 Hours</p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#F00">USA High:&nbsp;<?php echo $usahigh ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#6CF">USA Low:&nbsp;<?php echo $usalow ?></p>
<p align="center" style="font-size:90%; font-weight:lighter; color:#999">Max Precip:&nbsp;<?php echo $usaprecip ?></p>
<!--- end US Extremes -->
The colors I'm using are arbitrary at best.  And, yes, CSS would be neater.

Looks like he doesn't have 'usaextremes.php' on his server. :/

Will

A properly functioning 'usaextremes.php' displays nothing, Will. :-)  The PHP 'echo' statements render the extremes visible in the browser.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: USA Extremes
« Reply #32 on: September 22, 2012, 07:37:02 PM »
If you view-source on http://www.hayskansasweather.com/usaextremes.php it shows
Quote
<!-- USA Extremes Script Version 2.01. -->
<!-- The cache life HAS NOT expired and fresh data was not written to the cache file -->
<!-- usahigh='102&nbsp;&deg;F <br/>Imperial, CA' -->
<!-- usalow='15&nbsp;&deg;F <br/>Hazen, ND'-->
<!-- usaprecip='3.04&nbsp;in <br/>Miami, FL' -->
<!-- $filemtime = 1348355680 $cache_age = 1259 seconds. -->
<!-- Cache refresh rate = 3600 seconds.  Cache age = 1259 seconds. -->
which shows the script is working normally.

To paraphrase Obi-wan Kenobi,

"Use the source, Luke"

<groan>
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: USA Extremes
« Reply #33 on: September 22, 2012, 07:52:36 PM »
Hi,

I was fiddling with this last night and could not get it working, maybe because  " the force " was not with me. Could not figure out how to work that ?force=1 either, but got up this morning and all was working.. Guess sleeping on it paid off.

Also Ken, on the php.ini, I have the following:

allow_url_include = On
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
allow_url_fopen = 1;
allow_url_include = 1;
allow_url_fopen = on

Is there a difference between the fopen=1; and fopen=on?  Do I need to have both of them?

Thanks Ken and Mark for getting it working again and not relying on AccuWeather.

--Stan Y.
  Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: USA Extremes
« Reply #34 on: September 22, 2012, 08:36:14 PM »
Hi Stan,

There is no difference between 'on' and '1' and 'off' and '0', but we tend to use 'on' and 'off' for clairity.

You only need:

error_reporting = E_ALL & ~E_NOTICE
allow_url_fopen = on

in your php.ini ... I don't recommend having

allow_url_include = on

in the php.ini as it might provide a path for miscreants to include a remote malware script to run on your website.
The template set and scripts do not need allow_url_include active, and the default for PHP5+ is to have it 'off'

Best regards,
Ken
« Last Edit: September 23, 2012, 12:23:44 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: USA Extremes
« Reply #35 on: September 22, 2012, 10:38:51 PM »
Hi Ken,

Thanks for the recommendations and clarifications on the php.ini lines.  I got it edited, so hope that all is working.

Aloha,

--Stan Y.
   Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline Bill714

  • Contributor
  • ***
  • Posts: 121
    • Fall River Weather
Re: USA Extremes
« Reply #36 on: October 13, 2012, 09:23:45 PM »
OK I got it running on the side bar but how do I edit it so it looks like Silversword usa extremes

Thanks bill

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: USA Extremes
« Reply #37 on: October 14, 2012, 01:59:33 AM »
Hi Bill,

Check out this place on this forum http://www.wxforum.net/index.php?topic=15380.0. Go down near the bottom or just read the entire topic.  Hope that this helps a bit.

--Stan Y.
   Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline Bill714

  • Contributor
  • ***
  • Posts: 121
    • Fall River Weather
Re: USA Extremes
« Reply #38 on: October 14, 2012, 06:40:16 AM »
Thanks Silversword  fixed,  Man wish I was in Hawaii sunny and 80. We had our first frost here with a low of 33   

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: USA Extremes
« Reply #39 on: October 15, 2012, 01:21:30 AM »
Hi Bill,

You are welcome.  Glad that you got it working the way you like it.

Weather has been pretty good here so far. Being in the Tropics can get rather boring at times...

--Stan Y.
   Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: USA Extremes
« Reply #40 on: January 17, 2014, 03:31:51 AM »
A few days ago my non-communicative host updated PHP to 5.4.23. Their default for allow_url_fopen is off, which, as Ken has mentioned, should be on. If yours goes south as mine did be sure to check this setting.
John
W7JKG

Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: USA Extremes
« Reply #41 on: January 19, 2014, 10:05:13 AM »
Hello,

I decided to switch to Ken's usaextreme.php code. When I run it I get a blank page. I made sure the cache file is set for 666 and I did the force1. In advance I appreciate the help to get this working. Thank you.

Bob

http://lebanontnwx.org/usaextremes.php
Bob
KK4QXH

Offline Silversword

  • --Stan Y.
  • Forecaster
  • *****
  • Posts: 560
    • Up Country Maui Weather
Re: USA Extremes
« Reply #42 on: January 19, 2014, 03:00:35 PM »
I decided to switch to Ken's usaextreme.php code. When I run it I get a blank page. I made sure the cache file is set for 666 and I did the force1. In advance I appreciate the help to get this working. Thank you.
http://lebanontnwx.org/usaextremes.php

Hi Bob,

I get the same results from my usaextremes.php also.  If I am not mistaken, I think this script runs in conjunction withe the USA Extremes within the menu bar. You might want to include this in your menu bar. Read some of the discussions here: http://www.wxforum.net/index.php?topic=15380.0 if you have not already.

Regards,

--Stan Y.
  Maui, Hawaii
Stan Y. - KH6HHG - Maui, Hawaii
 --- Blitzortung ID: 993
 --- FlightRadar24 ID: F-PHOG1

WDL 6.05
MS Windows 7 Pro
Dell Optiplex GX280-Intel Pentium 4 CPU 3.00GHz, 4 GB RAM
Davis Vantage Pro 2+ Wireless
Webcam: Axis 211

Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: USA Extremes
« Reply #43 on: January 20, 2014, 10:00:37 AM »
Hi Stan,

Thanks for the suggestion. After reading your post I did check out the other thread. My knowledge of coding is very limited so I am not sure how I would get Ken's Script into my menu bar. In the past I have figured out how to get additional external links into the menu.php but inserting this script I am not sure what to do. I would like the USA extremes to appear in the menu below the external links and before the style options. Hoping someone can help me with getting that accomplished. I wonder why the script produces no results when it is stand alone versus the suggestion it has to be in the menu.php to do so. Oh the world of coding! Someday I hope to learn more. Any assistance appreciated.

Bob
lebanontnwx.org
Bob
KK4QXH

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: USA Extremes
« Reply #44 on: January 20, 2014, 10:17:15 AM »
Here's my menubar.php with Ken's script. I have a few different things in there, but this gives you an idea Bob.

Code: [Select]
<?php
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Base-USA template set)
############################################################################
#
# Project: Sample Included Website Design
# Module: menubar.php
# Purpose: Provides the menubar for the system
Authors: Kevin W. Reed <kreed@tnet.com>
# TNET Services, Inc.
#               Ken True <webmaster@saratoga-weather.org>
#               Saratoga-Weather.org
#
Copyright: (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
# This document uses Tab 4 Settings
############################################################################
//Version 1.01 - 28-Jul-2012 - added support for nws-alerts scripts
require_once("Settings.php");
require_once(
"common.php");
include_once(
'usaextremes.php');
############################################################################
?>

<!-- menubar -->
<div class="doNotPrint">
      <div class="leftSideBar">
        <p class="sideBarTitle">Navigation</p>
<?php 
// NOTE: when adding new links to the site, put them in as <li></li> entries in
//   the <ul></ul> shown below.  The order of the links is the order they appear
//   in the left navigation menu.  
// Be careful to only use html as shown below, otherwise the program that
//   automatically shows which page you're on won't work quite right.
// Don't use single-quotes in the following area unless you prefix it with a 
//   backslash.
//   Correct:  "Steve\'s page"
//   Wrong:    "Steve's page"    <=== this will cause a PHP error in menubar.php
//
// Be sure to include a title="..." tag so folks can see more info via a tooltip
//   as they mouse over the link in the menu.
//Don't change the next line in any way
$html '
        <ul>
          <li><a href="wxindex.php" title="Home">Home</a></li>
          <li><a href="wxforecast.php" title="5-day Forecast">Forecast</a></li>
          <li><a href="wxsimforecast.php" title="WXSIM Forecast">WXSIM Forecast</a></li>
          <li><a href="wxradar.php" title="Radar">Radar</a></li>
          <li><a href="wxadvisory.php" title="Watches, Warnings, Advisories">Advisories</a></li>
          <li><a href="wxtrends.php" title="Daily weather statistics">Daily Stats</a></li>
          <li><a href="wxgraphs.php" title="24, 72, &amp; Monthly Graphs">Graphs</a></li>
          <li><a href="wxastronomy.php" title="Sun and Moon Data">Astronomy</a></li>
          <li><a href="wxlinks.php" title="Useful Links">Links</a></li>
          <li><a href="wxabout.php" title="About This Site">About Us</a></li>
          <li><a href="wxstatus.php" title="Station Status">Status</a></li>
        </ul>
'
// end of links set for site. Don't change this line in any way
 
if (isset($SITE['flyoutmenu']) and $SITE['flyoutmenu']) {
   global 
$FlyoutMenuText;
   print 
"<div class=\"flyoutmenu\">\n";
   print 
$FlyoutMenuText;
   print 
"</div>\n";
 } else {
gen_navlinks($html); // generate the links set with highlight for the current page
 
}
?>

<?php 

 
if(isset($showSidebar) and $showSidebar) {
    include_once(
"ajax-sidebar.php");
 } 
# Note: add other links and stuff to the left sidebar above the </div><!-- end leftSidebar -->
# as shown in the sample below.
# Keep in mind that the width allowed is about 110px
#
# if you don't want anything to appear extra here, just delete the lines
# <!-- external links -->
#   down to and including
# <!-- end external links -->
?>

<!-- external links -->

<!-- NOAA Weather Radio from Weather Underground -->
<p class="sideBarTitle">NOAA Radio</p><br>
<a href="javascript:%20void(0)" onclick="window.open('http://www.wunderground.com/wxradio/smallplayer.html?stationid=thepathfinder100|575|2875', 'windowname1', 'width=325, height=225'); return false;" title="NOAA Weather Radio Live - click to listen"><img src="/images/NOAA-1.gif" width="100" height="85" border="1" alt="Link to Live NOAA Weather Radio" style="margin-left: 3px"/></a>

</ul>
<br>
<p class="sideBarTitle">Daylight Hours</p>
    <div class="sideBarText" style="font-weight:lighter; font-size: 6.5pt; text-align: center; margin-bottom:-4px">
          <?php
            
//Make piechart
            
$testtime substr($hoursofpossibledaylight,0,2);
            
$testminute substr($hoursofpossibledaylight,3,2);
            
$testminute=$testminute/60;
            
$testresult=$testtime+$testminute;
            
$testljus=round(($testresult/24)*100,1);
            
$testmorker=100-$testljus;
        
?>

            <span class="thisPage" style="position: relative; font-weight:lighter">
          <?php
            $time_arr 
explode(':'$hoursofpossibledaylight2);
            echo (int)
$time_arr[0] . " hrs " . (int)$time_arr[1] . " min";
            echo 
'<br/>of Daylight Today<br/>';
        
?>

            </span>
           <img style="margin-top:4px" src="http://chart.apis.google.com/chart?chs=100x60&amp;chma=0,0,0,0&amp;chd=t:<?php echo $testmorker;?>,<?php echo $testljus;?>&amp;cht=p3&amp;chp=1.6&amp;chf=bg,s,FFFFFF&amp;chco=000000,FFFF19" alt="graph"/>
      <br />
            <span style="position:relative; float:left; margin-top:-36px; margin-left:18px; font-weight:lighter; color:#FFFFFF">        <!-- was -5 -->
                <?php echo $testmorker "%"?>
            </span>
            <span style=" position:relative; float:right; margin-top:-36px; margin-right:18px; font-weight:lighter; color:#000000">      <!-- was 5 -->
                <?php echo $testljus "%"?>
            </span>
            <span class="thisPage" style=" position:relative; font-weight:lighter; top:-8px">
        <?php
            
echo '<br/>Which is <br/>';
            
$time_arr explode(':'$changeinday);
            if (
substr($time_arr[0],0,1) != "-") {         // -0 when getting shorter
                
echo (int)$time_arr[1] . " Min Longer";
            } else {
                echo (int)
$time_arr[1] . " Min Shorter";
            }
            echo (
'<br />Than Yesterday');
        
?>

            </span>
      </div>  <br>
<br/>
<p class="sideBarTitle">USA Extremes</p>
<br />
<table align="center" cellspacing="0" cellpadding="0" border="0" width="90">
<tr>
<td align="center"><span style="font-size: 75%; color: black;">Past 24 hours</span></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><span style="font-size: 90%; font-weight:bold; color: red;">High Temp</span></td>
</tr>
<tr>
<td align="center"><span style="font-size: 80%; color: black;"><?php print $usahigh?></span></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><span style="font-size: 90%; font-weight:bold; color: blue;">Low Temp</span></td>
</tr>
<tr>
<td align="center"><span style="font-size: 80%; color: black;"><?php print $usalow?></span></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><span style="font-size: 90%; font-weight:bold; color: green;">Precipitation</span></td>
</tr>
<tr>
<td align="center"><span style="font-size: 80%; color: black;"><?php print $usaprecip?></span></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
</table>
<br />
<p class="sideBarTitle">Weather Links</p>
<ul>
   <li><a href="http://www.weather.gov/" title="USA National Weather Service">NOAA/NWS</a></li>
<li><a href="http://www.erh.noaa.gov/er/bgm/index.php" title="Weather-Display Forum">NWS Binghamton</a></li>
   <li><a href="http://www.wunderground.com/" title="Weather Underground">Weather Underground</a></li>
<li><a href="http://www.weather-watch.com/smf" title="Weather-Display Forum">Weather-Display Forum</a></li>
   <li><a href="http://www.wxforum.net/index.php" title="Weather-Display Forum">WXForum</a></li>
</ul>

<br>

<br>
<!-- end external links -->
<?php if($SITE['allowThemeSwitch']) { // insert code for theme switcher ?>
   begin Color Theme Switcher Plugin http://www.642weather.com/weather/scripts.php -->
  <div class="thisPage" style="margin-left: 5px; font-weight: normal;">
  <?php print_css_style_menu(1); ?>
  </div>
  <!-- end Color Theme Switcher Plugin http://www.642weather.com/weather/scripts.php -->
<?php // end code for theme switcher ?>
      </div><!-- end leftSidebar -->
</div><!-- end doNotPrint -->
<!-- end of menubar -->
<?php 

if (isset($_REQUEST['show']) and strtolower($_REQUEST['show']) == 'settings') {
  print 
"<!-- current settings\n" htmlentities(print_r($SITE,true)) . " -->\n";
}

// generate navigation links script - Ken True - webmaster@saratoga-weather.org

function gen_navlinks($html) {
 
preg_match('|<ul>(.*)</ul>|is'$html$betweenspan); // find the navigation div
 
$rawlinks  $betweenspan[1]; 

 
// Chop up each link and place in array 
 
preg_match_all("/<li.*>(.*)<\/li>/Uis"$rawlinks$betweenspan);  
 
$links $betweenspan[1]; 

 
$ourPage $_SERVER['PHP_SELF'];
 
$doDebug false;
 echo 
"<!-- this page='$ourPage' -->\n";
 if (isset(
$_REQUEST['page']) ) { // support testing
   
$ourPage $_REQUEST['page'];
   echo 
"<!-- using page='$ourPage' as test -->\n";
   
$doDebug true;
 }
 if (isset(
$_REQUEST['debug']) ) { // support testing
   
$doDebug true;
 }
  
$t pathinfo($ourPage); // extract base filename from link
  
if ($doDebug) {print "<!-- pathinfo\n" print_r($t,true) . "-->\n"; }
  
$ourPage $t['basename'];
  
// Now generate the code 
 
print "<!-- navigation links -->\n";
 print 
"<ul>\n";
 
 foreach (
$links as $i => $link) {
   if (
preg_match('|<a.*href="([^"]+)"[^>]*>(.*)</a>|i',$link,$matches) ) {
   if($doDebug) {  print "<!-- Matches for i=$i '$link': \n" print_r($matches,true) . "-->\n"; }

 //Matches: Array
 //(
 //   [0] => <a href="index.php" title="Current Conditions/Home">Home</a>
 //   [1] => index.php
 //   [2] => Home
 //)

  if ($matches[1] == $ourPage) {
// we're on our page
print "<li><span class=\"thisPage\">" langtransstr($matches[2]) . "</span></li>\n";
  } else {
    $t langtransstr($matches[2]);
print "<li>" str_replace($matches[2],$t,$matches[0]) . "</li>\n";
  }
    } else { 
// must be just text
      
print "<li>" $link "</li>\n";
    } 
// end if has an <a href=
 
}
 print 
"</ul>\n<!-- end of navigation links -->\n";
 } 
// end of gen_navlinks function
?>

Tony




Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: USA Extremes
« Reply #45 on: January 20, 2014, 01:15:00 PM »
Hi Tony,

Thank you very much. I did some trial and error in where to place it in the menu.php and  it seems to be working great. Thank you again. Question how did you get the wind speed high in yours. Just curious. Thank you again.

Bob
Bob
KK4QXH

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: USA Extremes
« Reply #46 on: January 20, 2014, 02:38:13 PM »


I went fishing and figured out that  the wind data is there in that table too. And with a little trial and error
I added this to the usaextremes.php script

Code: [Select]
//Finds USA High Wind
preg_match_all('|<div id="wind"[^>]*>(.*)</div>|Uis', $html2, $matches);
//  print "<pre>\n".print_r($matches,true)."</pre>\n";

if(isset($matches[1][0])) {
  $windtable = $matches[1][0];
  preg_match_all('|<td>(.*)</td>|Uis',$windtable,$matches);
 
//  print "<pre>\n".print_r($matches,true)."</pre>\n";

  $usawind = trim(preg_replace("|\n|is",'',strip_tags($matches[1][2]).'<br/>'.strip_tags($matches[1][0]))); 
  print "<!-- usawind='$usawind' -->\n";
} else {
$usawind = 'N/A';
}



And added this to menubar.php

Code: [Select]
<td align="center"><span style="font-size: 90%; font-weight:bold; color: orange;">High Wind</span></td>
</tr>
<tr>
<td align="center"><span style="font-size: 80%; color: black;"><?php print $usawind?></span></td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>

My feeble attempt at coding lol  8-)

Tony


Tony




Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Re: USA Extremes
« Reply #47 on: January 20, 2014, 03:11:06 PM »
Nice Tony.   =D&gt;




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2297
    • CNYWeather
Re: USA Extremes
« Reply #48 on: January 20, 2014, 03:32:39 PM »
Ken did all the hard work. I just fiddled with it.
Tony




Offline tnwxman

  • Forecaster
  • *****
  • Posts: 423
  • KK4QXH
    • Weather for Lebanon, TN 37087
Re: USA Extremes
« Reply #49 on: January 20, 2014, 03:35:21 PM »
Hi Tony,

Most excellent. Thank you sharing the wind information. Again thanks for all your help today!

Bob
Bob
KK4QXH

 

anything