WXSIM 3in1 for PHP 8.x and HTML5

Attached zip contains a version of the latest “3in1” scripts with updates for

  • PHP 8.2 and later
  • HTML5
  • UTF-8 and degree symbol, w/m²

Some minor adaptions are a more flexible width and adaptable number of periods in the grpahs.

The scripts are tested with data from 10-different WXSIM users.

The HTML5 checking was done with

Ready to check - Nu Html Checker

Disclaimer:
There are no changes made to the logic of the scripts. This update is only cosmetic

wxsim-wxall_php8_html5.zip (273.9 KB)

Have fun,
Wim

2 Likes

That’s awesome that you took the time to make it compatible with later versions of PHP.
Nice work, Wim. :clap:

Hi Wim,

Thanks for updating this script! Although it’s working, I get multiple warnings like this:
Warning : Undefined variable $noprectxt in /home/meteothes/public_html/wxsim_wxall_new/wxall.plaintext.php on line 204

Warning : Undefined variable $noprectxt in /home/meteothes/public_html/wxsim_wxall_new/wxall.plaintext.php on line 205

This is the test link where you can run the script:
https://www.meteothes.gr/wxsim_wxall_new/sivu2.php

My PHP version: 8.2.27

Any ideas?

Thanos

Hi Thanos

Thanks for reporting this.

  1. I left full error-reporting on so we could find new errors / warnings with this first download.
  2. I had already tested with your files also and received no messages.
    I re-tested see attached, no warnings either → screenshot
  3. I noticed 4 differences between my version of the script and yours. I will check later when at home.

Wim

@atsio

Hi Thanos,

Did you maybe copy the wxall.settings.php from the current wxsim_wxall folder to the new folder?

If so, please make a zip and post/mail it so I can test with it.


To get rid of the warnings change line 28 from

else {  ini_set('display_errors', 'On');   error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); }

to

else {  ini_set('display_errors',  0);  } # 

Wim

Cause by “No precipitation” setting in wxall.settings.php

$washowzeroprecip = true; # Show 0 mm rain as “No precip” in the tables?

Add a line 190 in wxall.plaintext.php

if (!isset ($noprectxt) ) {$noprectxt = ‘’;} # 2025-02-19 missing in definitions


I downloaded the original version

Download here! Size: 263.4 KB Updated: 09.10.2016

It was also in the original version.
PHP 5 - 7 used a null value for a not defined field. Nowadays it also gives a warning.

Wim

Hi Wim, thanks for replying!

The warnings disappear after updating line 28 in sivu2.php, but after inserting in line 190 the code that you provided in wxall.plaintext.php, I get this Fatal Error:

Fatal error : Uncaught Error: Undefined constant “��” in /home/meteothes/public_html/wxsim_wxall_new/wxall.plaintext.php:190 Stack trace: #0 /home/meteothes/public_html/wxsim_wxall_new/wxall.settings.php(94): include() #1 /home/meteothes/public_html/wxsim_wxall_new/sivu2.php(35): include(‘…’) #2 {main} thrown in /home/meteothes/public_html/wxsim_wxall_new/wxall.plaintext.php on line 190

Something else missing?

Thanos

Yes those are curly quotes to make human texts look better.
PHP needs straight quotes.

I will adept the line to look correct. Hope this one is the real thing.

if (!isset ($noprectxt) ) {$noprectxt = ’ ';} # 2025-02-19 missing in definitions

No also not, this one is correct

if (!isset ($noprectxt) ) {$noprectxt = '';} # 2025-02-19 missing in definitions

Wim

Great Wim! That did the trick! :slightly_smiling_face: :clap:

Thank you for everything!

Thanos

Hi Wim
Thanks for updating this, I have installed it and it works fine but for some reason I get some error messages as the attached image shows.
Do you know what this could be caused by?

https://refsnesbakken.svenni.no/wxsim_wxall/sivu2.php

Svenni

Hi Svenni,

I set error reporting on to find the warnings and other never noticed problems.
Those are complex scripts written by @Henka a “long” time ago.

So I will check where these warnings come from.

QUESTION:
To test I need the location of your WXSIM data files.
The files in the root are old ones
Edit: I found them so I can replicate the warnings.

Switch of messages:
Change line 28 in sivu2.php to
else { ini_set('display_errors', 0); }

Thanks,
Wim

I found the cause of the warnings.

You selected the default 10 plaintext dayparts to be shown in the scripts.

There are only 9 in the current upload.

The setting can be found in line 55 of wxsim_wxall/wxall.settings.php

$topfrcam       = 10;	        # How many forecasts do we show in "top-forecast"? Max = forecasts in plaintext.txt

Should be set to 9.

Probably I need to add some code to test if the setting is larger then the available dayparts.

Question as i have no current WXSIM installation.
Is the number of day-parts always the same in every forecast?

Wim

wxsim parameters go from 1 to 9 days max so cannot do 10

Hi,

Sorry, I was not specific enough.
There are 10 blocks of text in plaintext.txt
The icons, temp, wind a.s.o. are shown in the top-row.

Yesterday the information for svenni.no (Moss) in plaintext.txt was not complete. So the last part in the top-row was “empty”
And with error reporting “on” the messages appeared.
When switching off error-reporting there still is an empty part on the right.

If this happens more often, one better set the line to a lower value.

$topfrcam       = 10;	        # How many forecasts do we show in "top-forecast"? Max = forecasts in plaintext.txt

Hi Wim and thanks for the reply.
I set “$topfrcam” down from 10 to 9 and no error messages now.

Svenni

Attached screenshot shows early in the day a plaintext.txt with 10 blocks of text for 5 days
Later in the day there are only 9 blocks of text for 5 days.

Is there a max 5 day forecast version?
If not better generate a 6 day forecast when using these old wxsim-scripts

Wim

Hi Wim

Checked the settings in “wxsim” and in “Parameters - Numbers of day” and it was at 5 and I set it to 6 and ran “wxsim”, and when I set $topfrcam back to 10 it is displayed correctly now.