Author Topic: Add Advisory Bar to Forecast Webpage of Saratoga Template  (Read 362 times)

0 Members and 1 Guest are viewing this topic.

Offline Buford T. Justice

  • Member
  • *
  • Posts: 46
Add Advisory Bar to Forecast Webpage of Saratoga Template
« on: November 25, 2018, 07:35:44 PM »
I am trying to figure out with the Saratoga Weather templates how to add the weather advisory bar that is on index.php to the forecast webpage.

I figured I would put this code somewhere on wxforecast.php

Code: [Select]
<?php // insert desired warning box at top of page
  
if(isset($SITE['NWSalertsCodes']) and count($SITE['NWSalertsCodes']) > 0) {
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include($cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>

Whenever I add this, it breaks the forecast until I remove it.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Add Advisory Bar to Forecast Webpage of Saratoga Template
« Reply #1 on: November 25, 2018, 11:12:51 PM »
You're just missing the closing } on the if statement.

This code works fine
Code: [Select]
<div id="main-copy">
<?php // insert desired warning box at top of page
  
if(isset($SITE['NWSalertsCodes']) and count($SITE['NWSalertsCodes']) > 0) {
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include($cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
}
?>

<script type="text/javascript" src="nws-alertmap.js"></script>
         <?php 
 $doIncludeNWS true// handle advforecast2.php include
 $doIncludeWU  true// handle WU-forecast include also
 $doInclude    = true// handle ec-forecast and WXSIM include also
 $doPrint    = true//  ec-forecast.php setting
 include_once($SITE['fcstscript']); ?>


</div><!-- end main-copy -->
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 Buford T. Justice

  • Member
  • *
  • Posts: 46
Re: Add Advisory Bar to Forecast Webpage of Saratoga Template
« Reply #2 on: November 26, 2018, 12:57:03 AM »
Thanks saratogaWX!  If anyone else is wanting to do this, the file the above code replaces is in "wxforecast.php" at Line 72.  That may vary with new releases of the script.
« Last Edit: November 27, 2018, 09:26:05 PM by Buford T. Justice »