Author Topic: Saratoga template missing main section after update  (Read 719 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Saratoga template missing main section after update
« on: June 18, 2019, 11:12:55 AM »
Hi Ken,


Ok... this is weird.  I did a check-fetch-times.php?show=versions this morning and downloaded and installed the updates (4 files involved... quake-Canada, ec-radar, common and check-fetch-times).  Since the update, my main page looks like the attached screenshot.  Clicking any of the menu options results in the page changing, but no data displayed in the missing section.  I've temporarily re-directed the domain to the Meteotemplate (thanks, Jachym), but adding /index.php to rideauwx.info gets to the Saratoga template site.


Any direction you could point me in would be great.


Cheers!


Chris

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Saratoga template missing main section after update
« Reply #1 on: June 18, 2019, 11:31:29 AM »
Hi Ken,


Ok... this is weird.  I did a check-fetch-times.php?show=versions this morning and downloaded and installed the updates (4 files involved... quake-Canada, ec-radar, common and check-fetch-times).  Since the update, my main page looks like the attached screenshot.  Clicking any of the menu options results in the page changing, but no data displayed in the missing section.  I've temporarily re-directed the domain to the Meteotemplate (thanks, Jachym), but adding /index.php to rideauwx.info gets to the Saratoga template site.


Any direction you could point me in would be great.


Cheers!


Chris
This is the last html generated and it is incomplete.
If you remove this script from the sidebar, the page could display correctly
Code: [Select]
<!-- Code from Jerry Wilkins to display a Sunlight Piechart
includes civil, nautical, and astronomical twilight -->

<p class="sideBarTitle">Sunlight Hours</p>
    <div class="sideBarText" style="font-weight:lighter; font-size: 6.5pt; text-align: center; margin-bottom:4px; line-height:135%">
          <!-- cached data displayed -->

Wim

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga template missing main section after update
« Reply #2 on: June 18, 2019, 11:42:58 AM »
Doing a view-source of your index.php page shows it stops after
Code: [Select]
<!-- Code from Jerry Wilkins to display a Sunlight Piechart
includes civil, nautical, and astronomical twilight -->

<p class="sideBarTitle">Sunlight Hours</p>
    <div class="sideBarText" style="font-weight:lighter; font-size: 6.5pt; text-align: center; margin-bottom:4px; line-height:135%">
          <!-- cached data displayed -->

In your menubar.php there is code
Code: [Select]
<p class="sideBarTitle"><?php langtrans('Sunlight Hours'); ?></p>
    <div class="sideBarText" style="font-weight:lighter; font-size: 6.5pt; text-align: center; margin-bottom:4px; line-height:135%">
          <?php
            
include("heavens.php"); 
            
$hrsOfSunLight = array(); // [0] = yesterday, [1] = today, [2] = tomorrow
            
$changeinday2 get_changeinday(); 

My guess is that you'd modified the old common.php to include the get_changeinday() function and that is not included in the 'official' common.php code.   I'd suggest adding to menubar.php
Code: [Select]
// -----------------------------------------------------------------------------
// CHANGE IN DAYLENGTH FUNCTION:  computes length of yesterday, today,  & tomorrow
//   and then the change in day length from yesterday to today
// Written by SE Lincoln Weather                                                           .
// -----------------------------------------------------------------------------
// Alternate $changeinday routine that finds $changeinday2
if (!function_exists('get_changeinday')) { // Avoid fatally re-declaring this!!!
function get_changeinday() {
$hrsOfSunLight = array();
global $SITE;

$t = time()-86400; // Yesterday

for ($i=0; $i<(2+($displayTomorrow?1:0)); $i++) { // Only loop twice if no $displayTomorrow
$sun = date_sun_info($t, $SITE['latitude' ], $SITE["longitude"]);
$srise  = $sun["sunrise"];
$sset  = $sun["sunset"];
$sunhrs[$i] = $sset - $srise;   // $sunhrs is time between sunrise and sunset
$sh[$i] = floor($sunhrs[$i]/3600); // Sun Hours
$sm[$i] = floor((($sunhrs[$i]/3600)-$sh[$i])*60); // Sun Minutes
$ss[$i] = round(((((($sunhrs[$i]/3600)-$sh[$i])*60)-$sm[$i])*60),0); // Sun Seconds
$hrsOfSunLight[$i] = $sh[$i].':'.$sm[$i].':'.$ss[$i]; // Assemble strings in array
$t+=86400; // Next Day
}

$cindsign = (($sunhrs[1]-$sunhrs[0])>0)?'+':'-'; // Change IN Day sign

$shdiff = ($cindsign=='-'?($sh[0] - $sh[1]):($sh[1] - $sh[0])); // Difference in hours
$smdiff = ($cindsign=='-'?($sm[0] - $sm[1]):($sm[1] - $sm[0])); // Difference in minutes
$ssdiff = ($cindsign=='-'?($ss[0] - $ss[1]):($ss[1] - $ss[0])); // Difference in seconds
if ($ssdiff<0) { // negative number of seconds?
$smdiff -= 1; // borrow
$ssdiff += 60; // and carry
}
if ($smdiff<0) { // negative number of minutes?
$shdiff -=1; // borrow
$smdiff += 60; // and carry
}
$changeinday2 = $cindsign.$shdiff.':'.$smdiff.':'.$ssdiff; // Assemble cind string
$result = array($changeinday2,$hrsOfSunLight);
return $result;
}
}
// end of get_changeinday()
then the menubar will no longer error-out due to the missing function definition.

See this post for more info.
« Last Edit: June 18, 2019, 11:45:42 AM by saratogaWX »
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Saratoga template missing main section after update
« Reply #3 on: June 18, 2019, 11:45:43 AM »
Hi Wim,


Thanks very much.  I will have a boo at that and see how it got mangled.


Cheers!


Chris

Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Saratoga template missing main section after update
« Reply #4 on: June 18, 2019, 11:51:47 AM »
Hi Ken,


I have a very foggy recollection of adding the piechart to the sidebar and having to do an edit in common.php.  Your post cleared the fog somewhat.  Just did a side-by-side comparison of the new one with a backup and there it is..


Thanks very much for clearing the fog.  Now some work to do.


Cheers!


Chris

Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Saratoga template missing main section after update
« Reply #5 on: June 18, 2019, 01:08:21 PM »
Note to self..... don't update common.php without checking first.   ](*,)


Thanks again to you both for your help.


Chris

 

anything