Author Topic: Ajax today times incorrect?  (Read 5285 times)

0 Members and 1 Guest are viewing this topic.

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Ajax today times incorrect?
« on: February 19, 2008, 09:38:04 AM »
I've been adding some of the great Ajax scripting ideas and things are working well so far.  However, it appears that the times for some of todays events are incorrect. 

For example, the following snapshot of my ajax dashboard (on my home page) was taken at 7:30am but it shows the high temp today at 2:03pm, and the high UV at 11:58am:



I must have something set incorrectly in the ajax-dashboard.php file or somehwere else.  Any ideas?  I thought it may be a UTC and timezone setting issue but I don't see where...
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 229
    • http://southernctwx.com
Re: Ajax today times incorrect?
« Reply #1 on: February 19, 2008, 10:51:39 AM »
Hmmm....that is interesting! Does your code look like this?

Code: [Select]
                        <span class="ajax" id="ajaxtempmax">
                        <?php echo strip_units($maxtemp) . $uomTemp?>
                        </span><br />
                        <?php echo fixup_time($maxtempt); ?>
                      </td>

Regards,

Jack

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #2 on: February 19, 2008, 11:13:31 AM »
It looks exactly like that...
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #3 on: February 19, 2008, 03:30:40 PM »
Rick,
Only some of the variables displayed in the dashboard are AJAX-enabled.  In the area you'd cited, only the one's in red-underline are AJAXed .. the rest are loaded from the testtags.php by PHP -- that's why it's important to routinely upload the testtags.php through WD (I use 5 minute upload intervals).



Check the upload of your testtags.php to make sure it's 'current'.  I just looked at http://deltaweathercam.com/testtags.php?sce=view and saw that the last update was
Code: [Select]
$time = "8:20 PM"; // current time
$date = "02/17/08"; // current date
so it's not being uploaded routinely.

Glad you're giving the AJAX scripts a try :)

Best regards,
Ken
« Last Edit: February 19, 2008, 03:32:47 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #4 on: February 19, 2008, 05:35:36 PM »
Ken, thanks for the reply.  I see what you are saying.  However, I need some additional handholding.

I host my site on my own Apache server on the same PC running WD and VWS.  My web root does have that outdated testtags.php file, but I'm a bit lost about generating an updated copy via WD (new to it have been w/ VWS for 7 years).  In other words, it isn't a problem of getting the updated file to my web server, it is how to get it updated at all!  I have the testtags.txt file that has enough tags for me, but I need some tips about processing it with WD.  Right now WD creates all the web files, graphs, etc. in  my web_root/WD.

[edt add] I followed your instructions on adding testtags.txt to WD:

Code: [Select]
The 'testtags.txt' file should be copied to your Weather-Display \webfiles directory,
and you should use the Control Panel, Web files/Web page setup, Custom Web Page Setup Tab

Enter:
  testtags.txt in the first open (not used) 'Local file name' in the
               'Special file conversion' box
  testtags.php in the 'Remote file name' under the 'Local file name' box you used

Set the Toggle to ON and press 'Test', then OK buttons.

This should create a 'testtags.php' file with selected current WD conditions loaded into
PHP variables on your website.

I still can't find an updated testtags.php in my Weather-Display \webfiles directory, or in my webroot/wd directory.  HMMMMM  I'll look around some more...

Thanks so much for your help.

« Last Edit: February 19, 2008, 06:21:35 PM by k6dyc »
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #5 on: February 19, 2008, 09:38:02 PM »
Rick,
Is your Apache server on the same PC as your weather software?  Have you set up WD to FTP to your Apache server, or are you just doing a file copy (if on the same server)?

Sorry for the additional questions.. need to understand your setup a bit better.

The instructions you quoted are the correct ones for WD to FTP the testtags.txt to testtags.php, assuming that the general FTP setup is correct and the main internet switch on the Control Panel, FTP/Connections, Connections TAB is set to ON.  (the FTP host settings should be correct for host, remote directory (/), ftp-username, ftp-password.)

If you have both WD and Apache on the same system, then you can explore the settings for 'I have my own local network' .. I haven't tried that, but folks on the WD forum can likely assist there.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #6 on: February 19, 2008, 09:55:50 PM »
Yep, I have my own local network, no ftp needed.  I have it set in 'Web Files/Web Page', 'Real time Client ftp...' and have ticked the 'I am running my own web server, no ftp needed' box. 

I'll check the forum for tips on local web server setup issues.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #7 on: February 19, 2008, 10:53:29 PM »
Well, I suspected it was an issue with installing WD in Program Files under Vista and I think I was right.  I uninstalled the program and installed v10.37i build 08 which by default goes in C:\wdisplay.  After setting it up it created the files flawlessly.  I now an just waiting for a full day of data so it reads correctly.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #8 on: February 19, 2008, 11:19:46 PM »
That's great, Rick!  I'm glad you've found the solution.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #9 on: February 23, 2008, 02:50:58 PM »
Ken,

Things are running well, but I do have another issue. 

The Outlook icon is not showing up ($forecasticons[1]), and I can't find out why.  I do have all the icons in ajax-images and I can't tell where it is looking, or what *if anything* is in that variable. 

Any tips?  Thanks for your help.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #10 on: February 23, 2008, 04:10:33 PM »
That is strange Rick.

The code for that area is supposed to read
Code: [Select]
          <td align="center" valign="middle">
    <table border="0" cellpadding="2" cellspacing="0">
              <tr>
                <td align="center" style="font-size: 8pt;">
  <?php print $forecasticons[1]; ?>
   </td>
              </tr>
            </table>
  </td>
  and your page shows (after the PHP executes)
Code: [Select]
          <td align="center" valign="middle">
    <table border="0" cellpadding="2" cellspacing="0">
              <tr>
                <td align="center" style="font-size: 8pt;">
     </td>
              </tr>

            </table>
  </td>
Your forecast at http://deltaweathercam.com/advforecast2.php is showing the zone forecast (nice failover :) ) and $forecasticons[1] is plainly visible as 'tonight'. 

Where are you doing the include for advforecast2.php on the page.. Does your dashboard have
Code: [Select]
  $doPrintNWS = false; // suppress printing of forecast by get-nws-forecast.php
  @include_once("advforecast2.php"); // for the forecast icon stuff
near the top of the page?  If not, then the variable may not be initialized since PHP executes from the top of the page to the bottom.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #11 on: February 23, 2008, 05:36:32 PM »
You put me on the right track Ken, I had moved the reference to advforecast2.php to later in the file to have it display below the ajax dashboard.  I moved it back and all is well.  I now added my forecast from HW to replace the one from the adv script (couldn't figure out how to get it to display below the dashboard).  Actually I like the HW one a lot.

Thanks for your help.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #12 on: February 23, 2008, 05:41:54 PM »
Cool!  I'm glad we found the cause for the 'missing icon'.

With advforecast2.php included in 'quiet mode' near the top of the page, you can replicate the printing of the icons from it by copying the HTML generation from the script itself and placing it on the page where you'd like the forecast icons/temps to appear. 
Code: [Select]
  <table width="640" style="border: none;">
    <tr align="center" style="background-color: #FFFFFF;">
      <td><b>National Weather Service Forecast for: </b><span style="color: green;">
           <?php echo $forecastcity?></span><br />
        Issued by: <?php echo $forecastoffice?>
      </td>
    </tr>
    <tr>
      <td align="center">Updated: <?php echo $forecastupdated?>
          </td>
    </tr>
    <tr>
      <td align="center">&nbsp;
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr valign ="top" align="center">
        <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
            print 
"<td style=\"width: 11%;\"><span style=\"font-size: 8pt;\">$forecasticons[$i]</span></td>\n";
          }
        
?>

          </tr>
          <tr valign ="top" align="center">
          <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
            print 
"<td style=\"width: 11%;\">$forecasttemp[$i]</td>\n";
          }
          
?>

          </tr>
        </table>
     </td>
   </tr>
</table>

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #13 on: February 24, 2008, 03:15:00 PM »
Your comment about how to put the forecast icons at any location I want prompted me to add a forecast block to my left blocks section.  It only shows up on pages other than my home page which already has the forecast.

Your helpful comments are appreciated.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6766
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Ajax today times incorrect?
« Reply #14 on: February 24, 2008, 04:22:47 PM »
Hi Rick,
If you mean on your index.php (the wrapping frame), then all you need to do is add
Code: [Select]
<?php $doPrintNWS false; include_once("advforecast2.php");
?>

<table>
  <tr align="center" valign="top">
     <?php print "<td>$forecasticons[0]</td><td>$forecasticons[1]</td>\n"?>
  </tr>
  <tr align="center" valign="top">
     <?php print "<td>$forecasttemp[0]</td><td>$forecasttemp[1]</td>\n"?>
  </tr>
</table>

That will print the first and second icons+legends + temps.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline up10ad

  • USA Weather Finder
  • WxElement panel
  • Forecaster
  • *****
  • Posts: 572
  • Station will be back up someday...
    • Forecaster without a site
Re: Ajax today times incorrect?
« Reply #15 on: February 24, 2008, 09:39:47 PM »
I'm sorry Ken, I didn't word things correctly in my previous post.  It did make it sound like I was having an issue getting it to display, but that wasn't the case.  What I was trying to say was that I did successfully add the icons to my site, but I put them in a block on the left side and set them to only display on pages other than the home page, because the home page already has the forecast on it.  If you visit any page other than my home page you can see it in the left block.
Rick (K6DYC)
Have you joined USAWeatherFinder.com yet?

 

anything