WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Custom Website Templates => Topic started by: andro700 on April 07, 2022, 03:02:46 PM

Title: Radar Status
Post by: andro700 on April 07, 2022, 03:02:46 PM
Is there a way to run two different radar status scripts with two different radar sites? Just wondering

Chuck
Title: Re: Radar Status
Post by: saratogaWX on April 07, 2022, 03:34:44 PM
Yes.  But.. you can't just include() a differently named copy of the script (you'll get a fatal error when the second copy tries to redefine a function defined in the first copy).

You may have to use it like
Code: [Select]
readfile('https://your.website.com/radar-status.php?nexrad=RRRR&inc=Y&show=active'); where you'd like the second one (radar RRRR) to appear on the page. 

Title: Re: Radar Status
Post by: andro700 on April 07, 2022, 03:36:17 PM
Where would I put that in the script?

Chuck
Title: Re: Radar Status
Post by: saratogaWX on April 07, 2022, 03:38:24 PM
You don't put it in the radar-status.php script.  You put it on a wxsomename.php page script where you want to display a second radar site status.
Title: Re: Radar Status
Post by: saratogaWX on April 07, 2022, 03:57:43 PM
For example, in a copy of wxnewpage.php (I called wxradarstatus.php) you can put
Code: [Select]
<div id="main-copy">
 
<h1><?php langtrans(&#39;Status of Nearby Radar Sites&#39;); ?></h1>
   
   <p>Our local site<br/>
   <?php include_once("radar-status.php"); ?>
   </p>
   
   <p>Sacramento area<br/>
   <?php readfile("https://saratoga-weather.org/radar-status.php?nexrad=KDAX&inc=Y&show=active"); ?>
   </p>

   <p>Hanford area<br/>
   <?php readfile("https://saratoga-weather.org/radar-status.php?nexrad=KHNX&inc=Y&show=active"); ?>
   </p>
   
   
   
</div><!-- end main-copy -->
to display the three radars.
Title: Re: Radar Status
Post by: andro700 on April 07, 2022, 04:49:31 PM
Will work on it tomorrow. Thanks for the help.

Chuck
Title: Re: Radar Status
Post by: andro700 on April 08, 2022, 12:44:46 PM
Got it up and running here https://www.goblesweather.com/wxradarstatus.php (https://www.goblesweather.com/wxradarstatus.php)

Another question. Is there any way that you can put in the radar page? https://www.goblesweather.com/wxgr3hanisklgx-dbZ.php (https://www.goblesweather.com/wxgr3hanisklgx-dbZ.php)

Chuck