Weather Advisories Not Showing Up

Hello; I am using the Carter Lake Template. Weather Advisories are not showing up under the Advisory section. I have turned on NOAA warnings, selected my ZONE, which is showing, and ticked Auto Update Every 10 minutes. Any thoughts on what might be wrong? Or does this template even pull from WD or does it otherwise pull this info from the Weather Underground?

Thanks.

You dont have any advisories curently. This wasnt working
when you had one, correct?

It looks like the code is correct as far as I can tell

Correct, there are currently no advisories for southern Maine. But there were last night and nothing was showing up. If I set up a second zone it seems to work for a short bit and then stops again.

I had the same problems. I was told to change
the script around a little bit. Here’s the code
I’m using now:

<script type="text/javascript">
<!-- Javascript advisory message only appears when there is an advisory -->
<!--
var warning = "NO CURRENT ADVISORIES".toUpperCase();
var link = "wx4.html";
if (warning != "NO CURRENT ADVISORIES" && warning != "SHORT TERM FORECAST") {
	if (warning.indexOf("WATCH") > 0) {
       document.write('<div class="watchBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">NO CURRENT ADVISORIES</span></b> IN EFFECT ... [Click here for more info]</a></div>
');
	}
	else if (warning.indexOf("WARNING") > 0) {
       document.write('<div class="warningBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">NO CURRENT ADVISORIES</span></b> IN EFFECT ... [Click here for more info]</a></div>
');
	}
	else {
       document.write('<div class="advisoryBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">NO CURRENT ADVISORIES</span></b> IN EFFECT ... [Click here for more info]</a></div>
');
	}
}
//-->
</script>

Are you saying nothing showed up on your advisories page?

http://www.hazbro.com/weather/wx4.html

cnyweather,

Don’t you mean this code (Tom’s code)? tchazzard, you can use this code ONLY if your website host supports PHP.


<?php

// Force Defaults for Zone and County
if ( ! isset($_REQUEST['warnzone']) )
        $_REQUEST['warnzone']="PAZ069";
if ( ! isset($_REQUEST['warncounty']) )
        $_REQUEST['warncounty']="PAC017";
if ( ! isset($_REQUEST['warnlocal']) )
        $_REQUEST['warnlocal']="Newtown";

//You can pass data to this script with:
// http://www.carterlake.org/testadvisory.php?warnzone=IAZ069&warncounty=IAC155&warnlocal=Carter+Lake
//Where the zone is your zone and the county is your county and location is your location
//using pluses in place of spaces

$warnzone = $_REQUEST['warnzone'];
$warncounty = $_REQUEST['warncounty'];
$warnlocal = $_REQUEST['warnlocal'];

//import NOAA Advisory info
//data can be altered by changing the zone and county numbers
//Target data ends up in $targetwarn and $targettext[0]

$html = implode('', file("http://www.crh.noaa.gov/showsigwx.php?warnzone=${warnzone}&warncounty=${warncounty}"));

//Get the advisory headers and put them in an array

		preg_match_all('|<h3>(.*)</h3>|', $html, $headers);
		$warnheaders = $headers[1];

//Get the advisory text and put them into an array as well

		preg_match_all('|<pre>(.*)</pre>|Uis', $html, $headers);
		$warntext = $headers[1];

//If there is more than one advisory, we need to set its priority

if (count($warnheaders) >= 1) {

$i = 0;
$flag = 0;

//First, around here tornados are the biggest danger. A warning is critical information.
//Display this one first no matter what!

		while ($i < count($warnheaders)):
		if (preg_match("/Tornado Warning/i", $warnheaders[$i])) {  
			$targetwarn = $warnheaders[$i];
			$targettext = $warntext[$i];
			$targettext = explode("$$",$targettext);
			$flag = 1;
			break;
		}
		$i++;
	endwhile;

//Next if there are none of the above found. Display the first warning message.

		if ($flag == 0) {
		$i = 0;
		while ($i < count($warnheaders)):
			if (preg_match("/Warning/i", $warnheaders[$i])) {  
			$targetwarn = $warnheaders[$i];
			$targettext = $warntext[$i];
			$targettext = explode("$$",$targettext);
				$flag = 1;
				break;
			}
			$i++;
		endwhile;
	}

//Next if there are none of the above found. Display the first watch message.

		if ($flag == 0) {
		$i = 0;
		while ($i < count($warnheaders)):
			if (preg_match("/Watch/i", $warnheaders[$i])) {  
			$targetwarn = $warnheaders[$i];
			$targettext = $warntext[$i];
			$targettext = explode("$$",$targettext);
				$flag = 1;
				break;
			}
			$i++;
		endwhile;
	}

//Next if there are none of the above found. Display the first advisory message.

		if ($flag == 0) {
		$i = 0;
		while ($i < count($warnheaders)):
			if (preg_match("/Advisory/i", $warnheaders[$i])) {  
			$targetwarn = $warnheaders[$i];
			$targettext = $warntext[$i];
			$targettext = explode("$$",$targettext);
				$flag = 1;
				break;
			}
			$i++;
		endwhile;
	}

//Next if there are none of the above found. Display the first statement message.

		if ($flag == 0) {
		$i = 0;
		while ($i < count($warnheaders)):
			if (preg_match("/Statement/i", $warnheaders[$i])) {  
			$targetwarn = $warnheaders[$i];
			$targettext = $warntext[$i];
			$targettext = explode("$$",$targettext);
				$flag = 1;
				break;
			}
			$i++;
		endwhile;
	}

//Next if there are none of the above found. Set the advisory to default message.

	if ($targetwarn == "Hazardous Weather Outlook") {
		$targetwarn = "NO CURRENT ADVISORIES";
		$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
	} else if ($targetwarn == "No Active Hazardous Weather Conditions Found") {
		$targetwarn = "NO CURRENT ADVISORIES";
		$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
	} else if (empty($targetwarn)) {
		$targetwarn = "NO CURRENT ADVISORIES";
		$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
	} else if ($targetwarn == "Short Term Forecast") {
		$targetwarn = "NO CURRENT ADVISORIES";
		$targettext[0] = "THERE ARE NO ACTIVE WATCHES, WARNINGS OR ADVISORIES";
	}

	if ($targetwarn <> "NO CURRENT ADVISORIES") {

	$warnlist = 'ALL CURRENT ADVISORIES:';

		for ($i = 0; $i <= count($warnheaders); $i++) {
	    		$warnheaderplus = preg_replace( '| |', '+', $warnheaders[$i] );
	    		$warnlist = $warnlist . '
<a href="http://www.crh.noaa.gov/showsigwx.php?warnzone=' . $warnzone. '&warncounty=' . $warncounty . '&local_place1=' . $warnlocal . '&product1=' . $warnheaderplus . '" target="_new">' . $warnheaders[$i] . '</a>';
		}
	}

}

echo "<b>";
echo $targetwarn;
echo "</b>

<pre>";
echo $targettext[0];
echo $warnlist;
echo "</pre>";
?>

–Tim

No Tim, he’s referring to WD generated advisories using the template.

Tom,

OK. Wasn’t sure.

Thanks.

–Tim

Thank you for the code change suggestion. I will give it a try now that I am back home from some time away.

I know I’ve seen it on this board but can’t seem to locate it now…I’d like to have the nws “nowcast” show up on page 1 of the template and the actual now cast or advisory show on the advisories page…can someone help?

Thanks my friends

Mike

www.centralctweather.com

Mike,

Can you specify what you mean by the NWS “nowcast”?

Maybe you mean if there was a Special Weather Statement (for example), then on the home page it would just say that there was a Special Weather Statement in effect and when you click on it, it would take you to the Advisories page with the description?

–Tim

…as far as my “nws nowcast”…at times the national weather service might release a “short term forecast” “advisory” or “nowcast” when conditions warrant. I’m thinking it would be nice to have that message show as well…

Thoughts?

Mike

Mike,

Could you post the code that you have right now?

I know that you just have to take part of the coding out to show what you want.

Maybe Tom (carterlake) can help.

–Tim

I think this is what you are looking for. Thanks for your help
Mike

This is from Page 1 template or index

<div id="main-copy">

This is from the advisories template

Watches Warnings Advisories

	<pre><span style="text-transform: uppercase;">%NOAAEvent%</span>
	</pre>
	<pre>%noaawarningraw%</pre>
	<div align="left">
	  <pre>
	<img src=http://icons.wunderground.com/data/severe/current_severe_nostatefarm.gif width="630" height="480" border="0" alt="national advisories" /></pre>
</div>
</img>    </div>

Mike,

If you want everything to show, then you are going to change this:


<script type="text/javascript">
<!-- Javascript advisory message only appears when there is an advisory -->
<!--
var warning = "%NOAAEvent%".toUpperCase();
var link = "wx4.html";
if (warning != "NO CURRENT ADVISORIES" && warning != "SHORT TERM FORECAST" && warning != "SPECIAL WEATHER STATEMENT") {
   if (warning.indexOf("WATCH") > 0) {
       document.write('<div class="watchBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
   else if (warning.indexOf("WARNING") > 0) {
       document.write('<div class="warningBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
   else {
       document.write('<div class="advisoryBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
}
//-->
</script>

to this:


<script type="text/javascript">
<!-- Javascript advisory message only appears when there is an advisory -->
<!--
var warning = "%NOAAEvent%".toUpperCase();
var link = "wx4.html";
if (warning != "NO CURRENT ADVISORIES"){
   if (warning.indexOf("WATCH") > 0) {
       document.write('<div class="watchBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
   else if (warning.indexOf("WARNING") > 0) {
       document.write('<div class="warningBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
   else {
       document.write('<div class="advisoryBox"><a href="' + link + '" style="color: #FFFFFF;"><b><span style="text-transform: uppercase;">%NOAAEvent%</span></b> IN EFFECT ... [Click here for more]</a></div>
');
   }
}
//-->
</script>

Try that.

–Tim