Author Topic: Can't Set to mi in Earthquake Script  (Read 142 times)

0 Members and 1 Guest are viewing this topic.

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2253
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Can't Set to mi in Earthquake Script
« on: August 03, 2020, 03:44:37 PM »
Even though I seem to be doing it right, I can't set the Earthquake page to use mi, rather than km for the epicenter near column.  Or is it not possible to set to mi there?    Here are the two settings I use in quakejason.php:

# uncomment ONE of the $setDistanceDisplay lines to use as template for distance displays 
#  $setDistanceDisplay = 'mi (km)';
    $setDistanceDisplay = 'mi';
#  $setDistanceDisplay = 'km (mi)';
#  $setDistanceDisplay = 'km';

// setting for how to display distances .. uncomment one below
// note: will be overridden by $SITE['distanceDisplay']  or $setDistanceDisplay if it exists
//
//  $distanceDisplay = 'mi (km)';   // display for distances in 'N mi (K km)'
    $distanceDisplay = 'mi';   // display for distances in 'N mi'
//  $distanceDisplay = 'km (mi)';   // display for distances in 'K km (N mi)'
//  $distanceDisplay = 'km';   // display for distances in 'K km'

https://stillwaterweather.com/okareaearthquakes.php

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/wx/2ndhome.php

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8185
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Can't Set to mi in Earthquake Script
« Reply #1 on: August 03, 2020, 04:54:43 PM »
It seems you made the change inside a /* ... */ comment, instead of later on in the actual code to be executed
(after the // settings: --------------------------------------------------------------------  line).

Look further down, and you'll see that
Code: [Select]
//
    $distanceDisplay = 'mi (km)';   // display for distances in 'N mi (K km)'
//  $distanceDisplay = 'mi';   // display for distances in 'N mi'
is the one being executed.  Change that to
Code: [Select]
//
//  $distanceDisplay = 'mi (km)';   // display for distances in 'N mi (K km)'
    $distanceDisplay = 'mi';   // display for distances in 'N mi'

I find it's really helpful to have a syntax-highlighting editor (like Notepad++ or PHPStorm or Dreamweaver) to show what's a comment and what is code to be executed.
« Last Edit: August 03, 2020, 05:01:32 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything