WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: ea1hmy on January 01, 2019, 11:42:10 AM

Title: AjaxDashboard6.php
Post by: ea1hmy on January 01, 2019, 11:42:10 AM
Hello, what to do so that in the template of: Scott of BurnsvilleWeather
AjaxDashboard6.php
does not appear on it the DarkSky script
DS-forecast.php

http://www.meteotorrelavega.com/saratoga/index1.php
gracias
Title: Re: AjaxDashboard6.php
Post by: saratogaWX on January 01, 2019, 01:15:39 PM
Yes, several changes have to be made to ajax-dashboard6.php V6.95 to support DarkSky forecasts.

Change
Code: [Select]
if ($fcstby == 'WU') {

    $SITE['fcstscript'] = 'WU-forecast.php';    // Non-USA, Non-Canada Wunderground Forecast Script
    $SITE['fcstorg'] = 'WU';    // set to 'WU' for WeatherUnderground
    $fcstorg = $fcstby;
    $fcstscript = $SITE['fcstscript'];
}
to
Code: [Select]
if ($fcstby == 'WU') {

    $SITE['fcstscript'] = 'WU-forecast.php';    // Non-USA, Non-Canada Wunderground Forecast Script
    $SITE['fcstorg'] = 'WU';    // set to 'WU' for WeatherUnderground
    $fcstorg = $fcstby;
    $fcstscript = $SITE['fcstscript'];
}

if ($fcstby == 'DarkSky') {

$SITE['fcstscript'] = 'DS-forecast.php';    // DarkSky forecast
$SITE['fcstorg'] = 'DarkSky';    // set to 'DarkSky' for DarkSky forecast
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
  Then change
Code: [Select]
include_once($WXtags);   // for the bulk of our data
$doPrintNWS = false; // suppress printing of forecast by advforecast2.php
$doPrint = false; // suppress printing of ec-forecast.php
$doPrintWU = false; // suppress printing of WU-forecast.php
include_once($fcstscript); // for the forecast icon stuff
to
Code: [Select]
include_once($WXtags);   // for the bulk of our data
$doPrintNWS = false; // suppress printing of forecast by advforecast2.php
$doPrint = false; // suppress printing of ec-forecast.php
$doPrintWU = false; // suppress printing of WU-forecast.php
$doPrintDS  = false; // suppress printing of DarkSky DS-forecast.php
include_once($fcstscript); // for the forecast icon stuff
and lastly, change
Code: [Select]
if ($fcstorg == 'WU') {
    $forecasticons = $WUforecasticons;
    $forecasttemp = $WUforecasttemp;
    $forecasttitles = $WUforecasttitles;
    $forecasttext = $WUforecasttext;
} else if ($fcstorg == 'EC') {
to
Code: [Select]
if ($fcstorg == 'WU') {
    $forecasticons = $WUforecasticons;
    $forecasttemp = $WUforecasttemp;
    $forecasttitles = $WUforecasttitles;
    $forecasttext = $WUforecasttext;
} else if ($fcstorg == 'DarkSky') {
  $forecasticons = $DSforecasticons;
  $forecasttemp = $DSforecasttemp;
  $forecasttitles = $DSforecasttitles;
  $forecasttext = $DSforecasttext;

} else if ($fcstorg == 'EC') {
and that should let DarkSky be your forecast.

I've updated the Legacy scripts (https://saratoga-weather.org/scripts-legacy.php#scott) area with 695a version with these mods.
Title: Re: AjaxDashboard6.php
Post by: ea1hmy on January 01, 2019, 01:23:22 PM
Thank you very much Ken

my best wishes for 2019
Title: Re: AjaxDashboard6.php
Post by: big2000 on February 13, 2019, 08:01:01 AM
Yes, several changes have to be made to ajax-dashboard6.php V6.95 to support DarkSky forecasts.

Change
Code: [Select]
if ($fcstby == 'WU') {

    $SITE['fcstscript'] = 'WU-forecast.php';    // Non-USA, Non-Canada Wunderground Forecast Script
    $SITE['fcstorg'] = 'WU';    // set to 'WU' for WeatherUnderground
    $fcstorg = $fcstby;
    $fcstscript = $SITE['fcstscript'];
}
to
Code: [Select]
if ($fcstby == 'WU') {

    $SITE['fcstscript'] = 'WU-forecast.php';    // Non-USA, Non-Canada Wunderground Forecast Script
    $SITE['fcstorg'] = 'WU';    // set to 'WU' for WeatherUnderground
    $fcstorg = $fcstby;
    $fcstscript = $SITE['fcstscript'];
}

if ($fcstby == 'DarkSky') {

$SITE['fcstscript'] = 'DS-forecast.php';    // DarkSky forecast
$SITE['fcstorg'] = 'DarkSky';    // set to 'DarkSky' for DarkSky forecast
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
  Then change
Code: [Select]
include_once($WXtags);   // for the bulk of our data
$doPrintNWS = false; // suppress printing of forecast by advforecast2.php
$doPrint = false; // suppress printing of ec-forecast.php
$doPrintWU = false; // suppress printing of WU-forecast.php
include_once($fcstscript); // for the forecast icon stuff
to
Code: [Select]
include_once($WXtags);   // for the bulk of our data
$doPrintNWS = false; // suppress printing of forecast by advforecast2.php
$doPrint = false; // suppress printing of ec-forecast.php
$doPrintWU = false; // suppress printing of WU-forecast.php
$doPrintDS  = false; // suppress printing of DarkSky DS-forecast.php
include_once($fcstscript); // for the forecast icon stuff
and lastly, change
Code: [Select]
if ($fcstorg == 'WU') {
    $forecasticons = $WUforecasticons;
    $forecasttemp = $WUforecasttemp;
    $forecasttitles = $WUforecasttitles;
    $forecasttext = $WUforecasttext;
} else if ($fcstorg == 'EC') {
to
Code: [Select]
if ($fcstorg == 'WU') {
    $forecasticons = $WUforecasticons;
    $forecasttemp = $WUforecasttemp;
    $forecasttitles = $WUforecasttitles;
    $forecasttext = $WUforecasttext;
} else if ($fcstorg == 'DarkSky') {
  $forecasticons = $DSforecasticons;
  $forecasttemp = $DSforecasttemp;
  $forecasttitles = $DSforecasttitles;
  $forecasttext = $DSforecasttext;

} else if ($fcstorg == 'EC') {
and that should let DarkSky be your forecast.

I've updated the Legacy scripts (https://saratoga-weather.org/scripts-legacy.php#scott) area with 695a version with these mods.

And just to let everyone else know, you can do the right same thing on the mobile version of the script.

Nice job Ken! =D>
Title: Re: AjaxDashboard6.php
Post by: saratogaWX on April 03, 2019, 04:07:29 PM
I decided to take the plunge and repackage Scott's ajax-dashboard6 script set along with the needed images and support scripts into one distribution to make it easier for initial installs to use.  The dashboard was updated to allow both DarkSky and the new WU/TWC forecasts.  I took the opportunity to replace the Google charts sunpie with Gerry's version of the pie (made by heavens.php and cached in ./cache/heavenpie.png).  Also rooted around and collected the old included scripts needed, updated all for PHP7+ where needed.

Should make new installs a bit easier for folks.  Download the 6.95b package from legacy scripts (https://saratoga-weather.org/scripts-legacy.php#scott) page.

Best regards,
Ken