Why would my WXSIM forecast indicates that it is ‘Offline’ - the WXSIM forecasts are automatically produced every six (6) hours, thus, there is no reason for showing the WXSIM forecast as being offline.
I think that will be related to “$filemtime == == Wed, 31 Dec 1969 16:00:00 -0800”, in other words it isn’t correctly reading the timestamp of the file.
Warning: filemtime() [function.filemtime.html: stat failed for ../plaintext.txt in E:\htdocs\weather34WDbeta\w34_util_wxsim.php on line 41
The script can not get the filemtime = last-modified-time of the file.
This filemtime check is there so that we do not run the plaintext-parser.php multiple times when there is no new file during its 6 hour life.
The first thought, maybe windows using "" and the file starts with “…/” ??.
Second thought: running Kens script directly http://24.108.124.18/weather34WDbeta/wxsimPP/plaintext-parser.php the correct date time is found.
That date time is coming from the plaintext.txt file
OK, can you test this version?
It will use the date-time from the plaintext-file as parsed by Ken’s script, only if the stat fails.
===
I also found the culprit, your plaintext.txt is on a other location then expected
$plaintextFile = '../../wxsim/plaintext.txt'; // location of the WXSIM plaintext.txt
Normally the file is in the webservers root.
That is why the file-name-location in the parser is “…/…/plaintext.txt”
And in the other scripts “…/plaintext.txt”
Not strange at all, the original release contained hundreds of html “notices” / problems.
I removed them all, but had to rewrite 90% of the code.
I can probably change the code in such a way that you do not have to blacklist the template. I already changed the code, but need the extension to test with.
But that is for ‘one fo these days’ later next week.
Tomorrow it is “conformation” day for the grand children, to important for them and for me to miss that large family gathering.
I see a problem with weather alerts.
It shows the distance of a discharge (Nexstorm).
Instead of 1509 km he gives an alarm because of a thunderstorm at 1,509 km.
See red blocks.
Can you please PM me the link to the NSRealtime.txt file you are using? Then I can test / check.
The comma in the distance is a number_format error, I will check that.
The alert is always given if the “lightningtimeago” is less then 500 seconds.
Both the WeatherFlow or Boltek are used for that. Boltek has priority if both devices are available.
Wim, when is the WXSIM parser ‘plaintext-parser.php’ run, meaning at which stage during the loading of all the other templates? Is the WXSIM parser ‘plaintext-parser.php’ run before the ‘w34_util_wxsim.php’? If yes, then the value of the path to the ‘plaintext.txt’ data file set in ‘plaintext-parser.php’ template should be passed on to the ‘w34_util_wxsim.php’ template and not be fixed in the ‘w34_util_wxsim.php’ template, thus preventing the current situation, that is ‘assuming’ that a file/template is in the root directory when that file/template can/could be in a totally different directory.
The WXSIM parser ‘plaintext-parser.php’ needs to be edited in order to provide the required information for its proper operation - the ‘w34_util_wxsim.php’ template should not have be edited.
Note: On all the systems I have operating on my home/office server as well as my online server, no template, no data file is place in the root directory - for me, the root directory is ‘sacred’ and not to be used for any purposes except for an .htaccess routing file.
w34_util_wxsim.php serrvices all wxsim blocks/popups,
it is loaded by all wxsim scripts as the first include
and it then
=> compares the age of plaintext.txt versus the age of the cache arrays
==> if a new file arrived
===> it loads the parser
===> and saves Ken True’s arrays to the cache
==> if no new file arrived it loads the arrays from the cache
=> and returns the arrays to the calling script
Then the normal scripts can print what they need.
The WXSIM parser 'plaintext-parser.php' needs to be edited in order to provide the required information for its proper operation -
Yes it should be edited as it is the exact copy of Ken True's script. I stopped making small changes in someone else scripts as it always resulted in large problems
the 'w34_util_wxsim.php' template should not have be edited.
As w34_util_wxsim.php starts before the parser they both should now the exact location to check the filetime and to read the file
Note: On all the systems I have operating on my home/office server as well as my online server, no template, no data file is place in the root directory - for me, the root directory is 'sacred' and not to be used for any purposes except for an .htaccess routing file.
I agree with that 100%. That is why I have all my template/scripts in separate folders.
So I will make clear in the documentation that there are 2 locations to check.
As most wxsim users upload to the root, I leave the current relative addressing as is.
Thanks for finding that, it has been the same script form months.
The 24 hour clock can not have that problem. I will test tomorrow around noon.
If possible can you test this “enhanced” version.
Wim, rather than asking the user to check that the two locations be edited to point to the same location, could you not ask for the location of the ‘plaintext.txt’ data file in the main configuration template (as you ask for the path to the realtime data file) once the user has selected to use WXSIM when that product has been installed?