Author Topic: Leuven Meteoalarm.eu script Version 3  (Read 5181 times)

0 Members and 1 Guest are viewing this topic.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Leuven Meteoalarm.eu script Version 3
« on: August 04, 2014, 05:52:48 AM »
As of today the version3 of Meteoalarm.eu script is operational.

Demo and download at: http://www.weerstation-leuven.be/demowarningv3/demoWarning.php

This new version is tested with about 20 different test-files, and luckily, nearly all over Europe, the weather was bad for the last couple of days which gave enough test possibilities

Operational in the Saratoga template on my Meteobridge test-site http://www.wiri.be/saratoga/
And on my normal Leuven-template production site at:  http://www.weerstation-wilsele.be/

As the weather is sunny again here,  you need the examples on the demo site to realy see the possibillities of this script.
 
I trust that this "1 PHP-script" version will make implementation easier:
  • Just one script for all warnings in small and large versions
  • All external CSS, translation files and so on are removed and are now contained in the script itself
  • New naming conventions which removed  conflicts with language translations
  • Messagebox support ("Site in maintenance")
  • Cache improvements, adaptive cache times when Meteoalarm.eu is busy
  • Optional (white) warning box when Meteoalarm.eu can not be reached for a longer period
  • Only real PHP data in one language (en-UK)  is cached, resulting in a smaller cache file
  • All images are based on a  default-setting placed on your own site (two folders) lowering the load on the Meteoalarm.eu site and improving response times for your visitors

Succes, Wim

P.S. I know that CSS and language translation files should be separate from the scripts. But this is not a large forecast script with multiple pages such as graphs/tables a.s.o. It only outputs a few lines of nicely formatted output, and only when there are warnings to report in most cases.
The users who strugled with CSS and language includes and all kinds of conflicting settings asked for a "1 PHP-script' version.
« Last Edit: August 04, 2014, 05:55:21 AM by wvdkuil »

Offline ugo71

  • Member
  • *
  • Posts: 12
Re: Leuven Meteoalarm.eu script Version 3
« Reply #1 on: August 14, 2014, 08:12:13 AM »
Hello beautiful job you wanted to ask one thing which file should I change to be able to do the translation in Italian? Thank you
« Last Edit: August 14, 2014, 08:23:27 AM by ugo71 »

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #2 on: August 14, 2014, 08:23:40 AM »
Hello beautiful job you wanted to ask two things, I have to upload individual files in the root of the site or the entire folder and then which file I can change to make me the translation in Italian. Thank you
You could upload the folder (EUwarning) first, test it with
www.yourwebsite/EUwarning/wrnExample.php
modify all settings until you are satisfied.

If you do not like it, it is only one folder to remove.

When you are going to use the script:  copy the script wrnWarningv3.php to the main folder of your website (often the root).
Copy the folders with the images also!
Create your own text for the warning box, if you are going to use that.

In the main part of your script do the include 'wrnWarningv3.php';
At the exact place you want the warning to be shown, do  the echo.

Wim

Offline ugo71

  • Member
  • *
  • Posts: 12
Re: Leuven Meteoalarm.eu script Version 3
« Reply #3 on: August 14, 2014, 08:51:02 AM »
For the translation in Italian I can modify for example, the file wrnWarningv3 from line 805 to line 842

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #4 on: August 14, 2014, 09:07:30 AM »
For the translation in Italian I can modify for example, the file wrnWarningv3 from line 805 to line 842
You should set the defeault language from
Code: [Select]
$lang = 'en'; to italian
Code: [Select]
$lang = 'it'; Anfd then you can use the lines at the end of the script ( 887 -  924) , to translate from english to italian.
That way if someone uses any other language-code than en, de, fr or nl when visiting your site, the Italian texts are used.

Wim
« Last Edit: August 14, 2014, 09:13:27 AM by wvdkuil »

Offline ugo71

  • Member
  • *
  • Posts: 12
Re: Leuven Meteoalarm.eu script Version 3
« Reply #5 on: August 14, 2014, 09:36:35 AM »
Ok I solved for the translation, one last thing from me this time written in the box "There is a communication problem. Meteoalarm Go Directly to the site" what is the cause? Thank you for your support.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #6 on: August 14, 2014, 10:26:19 AM »
Ok I solved for the translation, one last thing from me this time written in the box "There is a communication problem. Meteoalarm Go Directly to the site" what is the cause? Thank you for your support.

It seems that there is a communication problem using the script on  your altervista.org website.
I have to check further.
I will come back later with more information.

Wim

Offline ugo71

  • Member
  • *
  • Posts: 12
Re: Leuven Meteoalarm.eu script Version 3
« Reply #7 on: August 14, 2014, 10:34:58 AM »
However, for some time gave me warnings that message then appeared

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #8 on: August 14, 2014, 10:40:46 AM »
However, for some time gave me warnings that message then appeared
That was because you were testing with another area code from the download. And that area was in the cache and valid for two hours after upload. You changed then to IT011, probably then the white error box appeared.

I just ran the example program on
http://leuven.altervista.org/EUwarning/wrnExample.php  for IT011 - Same results as yours.

Will do some more tests. Need some time to find out what is happening.

Wim

Offline ugo71

  • Member
  • *
  • Posts: 12
Re: Leuven Meteoalarm.eu script Version 3
« Reply #9 on: August 14, 2014, 10:46:13 AM »
Wait Wim I resolved I added a space when I entered the code in my area. Thank you for your patience

Offline Kylo

  • Member
  • *
  • Posts: 32
    • Private Wetterstation Braunschweig
Re: Leuven Meteoalarm.eu script Version 3
« Reply #10 on: January 30, 2015, 07:14:23 AM »
Hello Wim,

I have a problem with "warning for" ! Warning is Snow/Ice but the script says Wind ! looks like :



Any idea ? (english its only for understand what i mean , normaly its in German) !
« Last Edit: January 30, 2015, 07:20:17 AM by Kylo »
VP2 Pro Plus Aktiv, TOA Blitzortung System RED, NOAA WX-Sat, Weather Display


Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #11 on: January 30, 2015, 09:46:35 AM »
Hello Wim,

I have a problem with "warning for" ! Warning is Snow/Ice but the script says Wind ! looks like :



Any idea ? (english its only for understand what i mean , normaly its in German) !
You can check your script http://bswetter.de/wrnWarningv3.php?sce=view
lines 127-129
Code: [Select]
$warninglarge['aw22']   = array ('level' => 'Yellow', 'info' => 'Wind',          'imgLarge' => 'aw22.jpg', 'img' => '12.gif');
$warninglarge['aw23']   = array ('level' => 'Orange', 'info' => 'Wind',          'imgLarge' => 'aw23.jpg', 'img' => '22.gif');
$warninglarge['aw24']   = array ('level' => 'Red',    'info' => 'Wind',          'imgLarge' => 'aw24.jpg', 'img' => '32.gif');
should be changed to
Code: [Select]
$warninglarge['aw22']   = array ('level' => 'Yellow', 'info' => 'Snow/Ice',       'imgLarge' => 'aw22.jpg', 'img' => '12.gif');
$warninglarge['aw23']   = array ('level' => 'Orange', 'info' => 'Snow/Ice',       'imgLarge' => 'aw23.jpg', 'img' => '22.gif');
$warninglarge['aw24']   = array ('level' => 'Red',    'info' => 'Snow/Ice',       'imgLarge' => 'aw24.jpg', 'img' => '32.gif');
Succes, Wim

Offline Kylo

  • Member
  • *
  • Posts: 32
    • Private Wetterstation Braunschweig
Re: Leuven Meteoalarm.eu script Version 3
« Reply #12 on: January 30, 2015, 01:03:33 PM »
Solved, thank you very much !! \:D/
VP2 Pro Plus Aktiv, TOA Blitzortung System RED, NOAA WX-Sat, Weather Display


Offline MarkR

  • Member
  • *
  • Posts: 2
    • Marton Weather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #13 on: March 28, 2015, 05:58:36 AM »
beautiful.. thank you very much. I have been looking for something like this for a long time :)

Online Mapantz

  • Forecaster
  • *****
  • Posts: 781
    • Wareham Weather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #14 on: July 12, 2016, 06:37:14 AM »
Hi

I had this script running as a standalone on my site, but I had emails saying my site was down today. I figured out that it was this script (today has seen the first warning in the UK since I put it up) It's not the script as such, but I was using $warnArea   = 'UK'; - It has been working correctly up until a warning, by that I mean it was showing the green box and that the UK had no warnings. As soon as there is a warning issued for a single part of the UK, it fails, so obviously, the 'UK' only part works if there isn't a warning. I wanted to cover the UK as a whole, not a single area within the UK, any ideas?

Best regards.


Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Leuven Meteoalarm.eu script Version 3
« Reply #15 on: July 12, 2016, 07:25:27 AM »
Hi Tina,

I downloaded the script and looked at the code.

It looks like the script is getting data from this page:

http://www.meteoalarm.eu/en_UK/0/0/BE004.html

Where the "BE004" is the area code. However, if you try http://www.meteoalarm.eu/en_UK/0/0/UK.html, you will see the page has a completely different structure and layout, so I don´t think you can do it.

Online Mapantz

  • Forecaster
  • *****
  • Posts: 781
    • Wareham Weather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #16 on: July 12, 2016, 01:11:13 PM »
Cheers for the reply Jachym. It's not the end of the world! It's just a shame the 'UK' works correctly for no warnings, but not as a whole when there  are warnings. I'll just have to use 'UK001' for my particular region. :)


Offline WessexWeather

  • Senior Member
  • **
  • Posts: 83
    • WessexWeather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #17 on: October 07, 2016, 07:39:07 AM »
Hi Wim,

I have set this up according to your instructions, and the test link is working...

http://www.wessexweather.net/EUwarning/wrnExample.php?lang=en

Can you please provide instructions on what code I should use to add the text box and warnings to my own site? Unfortunately I am not a code expert!

Many thanks.
Cheers,

Simon (WessexWeather)


Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #18 on: October 08, 2016, 11:52:19 AM »
Hi Wim,

I have set this up according to your instructions, and the test link is working...

http://www.wessexweather.net/EUwarning/wrnExample.php?lang=en

Can you please provide instructions on what code I should use to add the text box and warnings to my own site? Unfortunately I am not a code expert!

Many thanks.
This is an explanation, more or less, copied from the readme in the download.

Include the script in the "first" part of every page you want the warnings to appear.
With Saratoga you could place it in top.php
This script will only work when the calling script has a php extension. It is of no use in a .htm or .html page.

When included, the script generates three PHP variables which contain the html for the boxes.. 
You can then  display those html texts on any part of that page
  • $wrnHead contains the complete HTML for your own message-box or is an empty string if you do not use this possibillity.
  • $wrnStrings contains the html for the warnings or for the green box or is an empty string, based on how you set your settings.
  • $ownpagehtml contains the html for the warnings or for the green box in the same "format" as on the meteoalarm.eu site.

Use the php instruction echo  to print the string you want. Put
Code: [Select]
echo $wrnStrings; at the place where you want the warning-box to appear.

Offline WessexWeather

  • Senior Member
  • **
  • Posts: 83
    • WessexWeather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #19 on: October 08, 2016, 12:39:41 PM »
Thanks Wim,

I followed those instructions which didn't work for me, presumably because my website is built using .htm rather than .php pages?

Is there a workaround, using iframes for example?
Cheers,

Simon (WessexWeather)


Offline Supercell

  • Member
  • *
  • Posts: 35
    • Dublin Weather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #20 on: March 13, 2018, 06:18:57 AM »
Hi,

Hope this is still supported?
I have been getting a time based error in the last week for this script, is this a problem on my hosts side?
Thanks for any advice.

Code: [Select]
<div style="margin-left: 114px;"><!-- module wrnWarningv3.php = version: 3.0c 2014-08-24 -->
<!-- warnings and other info goes here  -->
<!--
Severe weatherdata (./cache/warningIE004) cache times:
        cache time   = 2018-03-07T11:30:24+01:00 from unix time 1520418624
        current time = 2018-03-13T11:11:55+01:00 from unix time 1520935915
        difference   = 517291 (seconds)
        diff allowed = 900 (seconds) -->
<!-- Severe weatherdata loaded from http://www.meteoalarm.eu/en_UK/0/0/IE004.html  -->
<!-- ERROR Severe weatherdata (http://www.meteoalarm.eu/en_UK/0/0/IE004.html) Service returns no good data -->
<!-- upped cachetime from 900 to 1800 as no valid data was retrieved -->
<!--
Severe weatherdata (./cache/warningIE004) cache times:
        cache time   = 2018-03-07T11:30:24+01:00 from unix time 1520418624
        current time = 2018-03-13T11:11:55+01:00 from unix time 1520935915
        difference   = 517291 (seconds)
        diff allowed = 1800 (seconds) -->
<!-- ERROR no warnings  retrieved, script ends -->
<div style= "margin: 5px; border-radius: 5px; border: 1px solid grey; border-bottom: 3px solid grey; color: black; text-align: center; overflow: hidden; min-height: 15px; background-color: white;">
<p>There is a communication problem. Go directly to the Meteoalarm site :
<a href="http://www.meteoalarm.eu/en_UK/0/0/IE004.html?lang=en" target="_blank">www.meteoalarm.eu</a>
 and check the Weather-warnings there .</p>
</div>

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: Leuven Meteoalarm.eu script Version 3
« Reply #21 on: March 13, 2018, 06:25:13 AM »
Hi,

Hope this is still supported?
I have been getting a time based error in the last week for this script, is this a problem on my hosts side?
Thanks for any advice.

Code: [Select]
<div style="margin-left: 114px;"><!-- module wrnWarningv3.php = version: 3.0c 2014-08-24 -->
<!-- warnings and other info goes here  -->
<!--
Severe weatherdata (./cache/warningIE004) cache times:
        cache time   = 2018-03-07T11:30:24+01:00 from unix time 1520418624
        current time = 2018-03-13T11:11:55+01:00 from unix time 1520935915
        difference   = 517291 (seconds)
        diff allowed = 900 (seconds) -->
<!-- Severe weatherdata loaded from http://www.meteoalarm.eu/en_UK/0/0/IE004.html  -->
<!-- ERROR Severe weatherdata (http://www.meteoalarm.eu/en_UK/0/0/IE004.html) Service returns no good data -->
<!-- upped cachetime from 900 to 1800 as no valid data was retrieved -->
<!--
Severe weatherdata (./cache/warningIE004) cache times:
        cache time   = 2018-03-07T11:30:24+01:00 from unix time 1520418624
        current time = 2018-03-13T11:11:55+01:00 from unix time 1520935915
        difference   = 517291 (seconds)
        diff allowed = 1800 (seconds) -->
<!-- ERROR no warnings  retrieved, script ends -->
<div style= "margin: 5px; border-radius: 5px; border: 1px solid grey; border-bottom: 3px solid grey; color: black; text-align: center; overflow: hidden; min-height: 15px; background-color: white;">
<p>There is a communication problem. Go directly to the Meteoalarm site :
<a href="http://www.meteoalarm.eu/en_UK/0/0/IE004.html?lang=en" target="_blank">www.meteoalarm.eu</a>
 and check the Weather-warnings there .</p>
</div>
There is the link in the html to the warnings: http://www.meteoalarm.eu/en_UK/0/0/IE004.html
When you click it, it returns an unpopulated page for Weather warnings: Leinster

Probably the code for your area has changed or a similar problem.
Please try to find at the meteo-alarm site the correct code for your area.
If the data is not there, you can ask the meteo-alarm people why your link http://www.meteoalarm.eu/en_UK/0/0/IE004.html at their sir does not return good data.

This is the link for my area, just to compare the data with yours http://www.meteoalarm.eu/en_UK/0/0/BE004.html

Wim

Offline Supercell

  • Member
  • *
  • Posts: 35
    • Dublin Weather
Re: Leuven Meteoalarm.eu script Version 3
« Reply #22 on: March 13, 2018, 07:05:02 AM »
Thanks very much for that Wim, I think you are correct, looks like they have indeed changed the Irish regions, will update my site when back from work.
Should add, thanks very much for your scripts too, very much appreciated.