Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Saratoga Templates with PHP 7

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
ConligWX
Posts: 1571
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Saratoga Templates with PHP 7

Post by ConligWX »

saratogaWX wrote:Thanks for finding this.. I'll do an update (and look for more instances in my code).
No problem glad I could be of use.

not many in your templates but I have a few to do elsewhere.

Code: Select all

[/htdocs/weather] # grep -r ' each(' *.php
buoy-data.php:    while (list($key, $val) = each($Buoys)) { //write each hotspot
image-space-aurora.php:         while (list($numl, $line) = each($lines)) {
image-space-aurora-s.php:         while (list($numl, $line) = each($lines)) {
image-space-eit-284.php:         while (list($numl, $line) = each($lines)) {
image-space-eit-304.php:         while (list($numl, $line) = each($lines)) {
image-space-sat-env.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-ap.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-corona.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-cycle.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-disk.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-number.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-radio.php:         while (list($numl, $line) = each($lines)) {
image-space-solar-wind.php:         while (list($numl, $line) = each($lines)) {
image-space-xray.php:         while (list($numl, $line) = each($lines)) {
include-whos-online-header.php:      while (list($key, $value) = each($string)) {
mesonet-map-genhtml-inc.php:// while (list($key, $val) = each($Stations)) {
mesonet-map-genhtml-inc.php://while (list($key, $val) = each($Stations)) {
wo-worldmap.php:         while (list($numl, $line) = each($lines)) {
[/htdocs/weather] #
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
ConligWX
Posts: 1571
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Saratoga Templates with PHP 7

Post by ConligWX »

I take it

Code: Select all

while (list($numl, $line) = each($lines)) {
should be:

Code: Select all

foreach($lines as $numl => $line) {
Can you confirm?

I also noticed I lost the map image on "Who's online" though I dont know if this is yet related to php 7.2.x
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Saratoga Templates with PHP 7

Post by saratogaWX »

Yes, that is correct.

What script is that in?

Don't know about whos-online -- that was a Mike Challis creation.
User avatar
ConligWX
Posts: 1571
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Saratoga Templates with PHP 7

Post by ConligWX »

saratogaWX wrote:Yes, that is correct.

What script is that in?

Don't know about whos-online -- that was a Mike Challis creation.
yep Who's Online was from Mike, he has discontinues support for that script a while back. the script works but images are not shown now, cant say I remember when it stopped working tbh.

the while (list($numl, $line) = each($lines)) { ??

was in the another Mike Challis script some image handler script, though this is not used anyway. the other finding I had was the buoy data.

Code: Select all

buoy-data.php:    while (list($key, $val) = each($Buoys)) { //write each hotspot


which is yours I think.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Saratoga Templates with PHP 7

Post by BCJKiwi »

There seem to be a couple of instances in
mesonet-map-genhtml-inc.php
Line 208: while (list($key, $val) = each($Stations)) {
Line 241: while (list($key, $val) = each($Stations)) {

Not sure how to change these (if required?)
User avatar
ConligWX
Posts: 1571
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Saratoga Templates with PHP 7

Post by ConligWX »

BCJKiwi wrote:There seem to be a couple of instances in
mesonet-map-genhtml-inc.php
Line 208: while (list($key, $val) = each($Stations)) {
Line 241: while (list($key, $val) = each($Stations)) {

Not sure how to change these (if required?)
I posted that one earlier. https://cumulus.hosiene.co.uk/viewtopic.p ... 30#p129307

Code: Select all

while (list($key, $val) = each($Stations)) {
to:

Code: Select all

foreach($Stations as $key => $val) {
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Saratoga Templates with PHP 7

Post by saratogaWX »

You can change both as

Code: Select all

 foreach ($Stations as $key =>$val) {
as Simon said.

I'll be updating the mesonet-map set of scripts when I can work out the (pernicious) problem with Google's V3.32 API. Debugging it is a real pain and a slow slog.
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Saratoga Templates with PHP 7

Post by BCJKiwi »

Thanks,
sorry I missed the earlier reference
Post Reply