Edit: 13 Dec 2020 - BTJ is back on board and has a new release available on the original topic (link lower down)
I have no idea if there is any compatibility beteween the versions - It would be best to assume not !!!BTJ wrote:Version 2020-12-12 is now live. It is attached to the bottom of the first post in this thread.
The beteljuice has done a little 'house-keeping'
It would be a great shame for this excellent piece of work to fade away and it really does deserve a wider audience.
So the beteljuice has updated the the METAR urls, improved error handing and reporting, and .....
this version now has separate 'language' files and is compatible with most of your favourite templates.
I must stress that these are really minor changes and the logic and base code for the logic are unchanged and for installation / set up you should refer to the original article: viewtopic.php?f=14&t=9901
Update: fix to sager_test, and a few small debug tweaks to bt-sager-wc.php - 17th March 2019
Update: bt-sager-wc.php - original cURL rewritten 19th March 2019
From the readme ...
The zip should contain:
bt-sager-wc.php (The main program)
bt-sager-cu.php (A file to be processed by and uploaded by Cumulus)
bt-sager-en.php (English 'language' file)
sager_test.php (Optional test / debug page)
this README.txt
bt-sager-wc.php
If you are already using bt-sager this is a REPLACEMENT file.
bt-sager-cu.php
This is unchanged and if you are already using bt-sager
you do NOT need to change your existing file.
bt-sager-en.php
This is a NEW file - there is a minimum requirement of
one 'language' file !
sager_test.php
This is a renamed bt-sager.php to reflect it's true function.
There are a couple of very small changes, but you may keep
your original if you wish.
DIFFERENCES in set up to original.
If your site language is NOT 'en' English AND / OR you want more languages ....
1/ Change line #35 in bt-sager-wc.php
$sager_default_lang = 'en'; // 'look-up' array to use if not passed or defined elsewhere
Please use ISO code for language required !
2/ If no one has posted a suitable 'language' file ..
Make a copy of bt-sager-en.php - DO NOT REMOVE OR EDIT THIS FILE !
Name your copy bt-sager-??.php where ?? is the ISO code for the country.
Modify the content to suit and upload to your webspace.
PLEASE post it on the forum for others !!
That's it !!!!!
Notes on language selection ...
If you are using Saratoga templates the default language will be the one
defined in the $SITE file.
A change of language can be achieved by POST php?lang= OR php?langue=
This makes the page compatable with Saratoa and WeatherByYou templates and
several others.
You may of course create your own drop-down list to do the same thing.
Sequence:
First of all looks for any POSTED option and if it exists.
... upon failure it will look for your 'default' language.
If that fails .... It tries looking for 'en' English file.
You can use the test page or the page that contains the forecast
to see whats going on by 'view source' and looking for a group of
<!-- comment lines -->
eg.
<!-- bt-sager-wc loaded -->
<!-- server running PHP ver 5.3.28 -->
<!-- cURL is installed OK -->
<!-- Loading bt-sager-cu > success -->
<!-- Looking for language info -->
<!-- Trying to load bt-sager-en.php -->
<!-- Language file loaded .... -->
<!-- getting METAR for YSCB -->
<!-- METAR OK -->
regards - the beteljuice