Author Topic: Help adding NWS Short Term Forecast  (Read 1312 times)

0 Members and 1 Guest are viewing this topic.

Offline 96Cobra

  • Member
  • *
  • Posts: 35
Help adding NWS Short Term Forecast
« on: October 17, 2012, 02:10:14 AM »
I'm using Ken's scripts and I'd like to add the NWS Short Term Forecast to the bottom of my homepage. If you look at http://www.daculaweather.com/, for example, it's the few days directly below his wind rose & cloud conditions. I've found a couple of posts about it from a few years ago, but I'm not sure how, or where, to add the code to my page. I'm completely new to this and need to be spoon fed for now!

Another question... I currently have the outlook at the bottom of my homepage and the 2 days are stacked, how do I get these to display side-by-side? I'm pretty sure I've seen a few pages with them side-by-side.

Thanks, Roger

www.rkb2.com
« Last Edit: October 17, 2012, 03:52:31 AM by 96Cobra »

Offline jmcmurry

  • Jim McMurry
  • Forecaster
  • *****
  • Posts: 525
  • Davis Vantage Pro 2 Plus Wireless.
    • Juneau County Weather
Re: Help adding NWS Short Term Forecast
« Reply #1 on: October 17, 2012, 09:09:26 AM »
Roger,

See if the documentation on Ken's site http://saratoga-weather.org/scripts-carterlake.php#advforecast helps you figure it out.

- Jim

Forum Search and Google Can be Your Best Friends

Offline 96Cobra

  • Member
  • *
  • Posts: 35
Re: Help adding NWS Short Term Forecast
« Reply #2 on: October 17, 2012, 09:09:09 PM »
Hi Jim,

I've been setting everything up using Ken's site/templates but what I want to do is actually a Webster Weather script.  I basically want to have this...



With my local forecast info obviously, and place it at the bottom of my page instead of the current "outlook" I have there now.  I've tried a bunch of different things, but haven't got what I want yet.

Thanks,
Roger

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8621
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help adding NWS Short Term Forecast
« Reply #3 on: October 17, 2012, 11:01:59 PM »
While you can't use the full alternative dashboard (since it requires Weather-Display to drive it, and you're using WeatherLink), you can 'steal with pride' some of the code for the bottom of his dashboard to good effect :)

In ajax-dashboard.php, replace
Code: [Select]
<table width="620" border="0" cellpadding="3" cellspacing="3">
   <tr>
     <td style="text-align: left" class="datahead">&nbsp;<?php print $fcstorg?> <?php langtrans('Weather Forecast'); ?>&nbsp; -  <?php langtrans('Outlook'); ?>:&nbsp;<?php echo $forecasttitles[0]; ?> &amp; <?php echo $forecasttitles[1]; ?></td>
     </tr>
     <tr>
       <td align="center">
   <table width="620" border="0" cellpadding="3" cellspacing="3">
           <tr>
  <td class="data1" style="width: 80px;font-size: 8pt;border: none;text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[0] . "</strong><br />" $forecasttemp[0]; ?></td>
           <td style="width: 504px;" class="data1"><?php print "<b>$fcstorg " langtransstr('forecast') . ":</b> " $forecasttext[0] . "<br />\n";
   if ($fcstorg <> 'WXSIM' and isset($WXSIMtext[0]) ) {
      print '              <b>WXSIM ' langtransstr('forecast') . ':</b> ' $WXSIMtext[0] . "<br/>\n";
   }
   if (isset($SITE['DavisVP']) and $SITE['DavisVP'] and isset($vpforecasttext) and $vpforecasttext <> '') {
      print '        <b>Davis VP+ ' langtransstr('forecast') . ':</b> <span style="color: green; font-size:9pt">' ucfirst($vpforecasttext) . "</span>"
?>
</td>
           </tr>
  <tr><td colspan="2">&nbsp;</td></tr>
           <tr>
  <td class="data1" style="width: 80px;font-size: 8pt; border:none; text-align: center" valign="middle" align="center"><strong><?php echo $forecasticons[1] . "</strong><br />" $forecasttemp[1]; ?></td>
           <td style="width: 504px;" class="data1"><?php print "<b>$fcstorg " langtransstr('forecast') . ":</b> " $forecasttext[1];
   if ($fcstorg <> 'WXSIM' and isset($WXSIMtext[1]) ) {
      print '              <br/><b>WXSIM ' langtransstr('forecast') . ':</b> ' $WXSIMtext[1] . "\n";
   }
    ?>
</td>
           </tr>
       </table>
</td>
   </tr>
 </table>
<?php if($condIconType <> '.jpg') {
print "<small>".langtransstr('Animated icons courtesy of')." <a href=\"http://www.meteotreviglio.com/\">www.meteotreviglio.com</a>.</small>";

?>


with his alternative code
Code: [Select]
<table width="620" border="0" cellpadding="2" cellspacing="1" style="border:solid; border-color: #CCCCCC;">
   <tr>
     <td>
     <table width="100%" border="1" cellpadding="2" cellspacing="1">
       <tr>
         <td style="text-align: left" class="datahead">&nbsp;<?php print $fcstorg?> <?php langtrans('Weather Forecast'); ?>&nbsp; - &nbsp;
         <?php langtrans('Outlook'); ?>&nbsp;<?php echo $forecasttitles[0]; ?> &amp; <?php echo $forecasttitles[1]; ?></td>
       </tr>
       <tr>
        <td align="center" valign="middle">
      <table width="100%" border="0" cellpadding="2" cellspacing="3">
              <tr align="center">
        <td  style="font-size: 9px;border: none;text-align: center" valign="middle" align="center"><strong>
        <?php echo $forecasticons[0] . "<br />" $forecasttemp[0]; ?></strong>
        </td>
                 <td style="width: 240px; text-align: left" >
                 <?php print "<b>$fcstorg forecast:</b> " $forecasttext[0] . "<br />\n";
   if ($fcstorg <> 'WXSIM' and isset($WXSIMtext[0]) ) {
      print '              <span style="color: green;"><b>WXSIM ' langtransstr('forecast') . ':</b> ' $WXSIMtext[0] . "<br /></span>\n";
   }
   if (isset($vpforecasttext) and $vpforecasttext <> '') {
      print '        <b>' langtransstr('Local station forecast') . ':</b> <span style="color: green; font-size: 9px">' ucfirst($vpforecasttext) . "</span>"

?>
</td>
  <td style="font-size: 9px; border:none; text-align: center" valign="middle" align="center"><strong>
  <?php echo $forecasticons[1] . "<br />" $forecasttemp[1]; ?></strong></td>
           <td style="width: 240px; text-align: left" ><?php print "<b>$fcstorg " langtransstr('forecast') . ":</b> " $forecasttext[1];
   if ($fcstorg <> 'WXSIM' and isset($WXSIMtext[1]) ) {
      print '              <br/><span style="color: green;"><b>WXSIM ' langtransstr('forecast') . ':</b> ' $WXSIMtext[1] . "<br/></span>\n";
   }
    ?>
</td>
           </tr>
       </table>
        <?php if($condIconType <> '.jpg') {
print "<small>".langtransstr('Animated icons courtesy of')." <a href=\"http://www.meteotreviglio.com/\">www.meteotreviglio.com</a>.</small>";
        } 
        
?>
           
        </td>
       </tr>
       <tr>
           <td>
           <table width="100%" border="1" cellpadding="2" cellspacing="1">
       <tr>
         <td style="text-align: left" class="datahead">&nbsp;<?php print $fcstorg?> <?php langtrans('Short Term Weather Forecast'); ?></td>
       </tr>
           </table>
       </td>
       </tr>
       <tr>
       <td>
        <table width="100%" border="1" cellpadding="2" cellspacing="2">
              <tr>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[2]; ?><br/>
                      <?php echo $forecasttemp[2]; ?>
                 </td>
<td style="font-size: 10px;">
                      <?php echo $forecasticons[3]; ?><br/>
                      <?php echo $forecasttemp[3]; ?>
                 </td>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[4]; ?><br/>
                      <?php echo $forecasttemp[4]; ?>
                 </td>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[5]; ?><br/>
                      <?php echo $forecasttemp[5]; ?>
                 </td>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[6]; ?><br/>
                      <?php echo $forecasttemp[6]; ?>
                 </td>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[7]; ?><br/>
                      <?php echo $forecasttemp[7]; ?>
                 </td>
        <td style="font-size: 10px;">
                      <?php echo $forecasticons[8]; ?><br/>
                      <?php echo $forecasttemp[8]; ?>
                 </td>
              </tr>  
           </table>
       </td>
       </tr>
    </table>
</td>
</tr>
</table>
and you will have what you wanted.

If you'd like, you can download ajax-dashboard2.php from here (name it ajax-dashboard.php on your site) -- it's the current ajax-dashboard V1.25 - 22-Jan-2012 with the above mod at the bottom.

Enjoy, and 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 96Cobra

  • Member
  • *
  • Posts: 35
Re: Help adding NWS Short Term Forecast
« Reply #4 on: October 18, 2012, 01:55:49 AM »
Thank you Ken!

This is exactly how I wanted it, just haven't learned enough to figure it out myself.  This is much better than the WeatherLink html pages I ran for a few years! Now off to see what else I can screw up... err... adjust!  \:D/

Thanks,
Roger

 

anything