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

BT's Sager PHP Script V2 - For Cumulus

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

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: BT's Sager PHP Script V2 - For Cumulus

Post by ConligWX »

OK i have it working, not the way you or BT have shown however.

bt-sager.php and sager_test.php worked when called directly.
bt-sager-wc.php showed the 24-48 forecast - though with "document.write" in front of it.

now using the code:

Code: Select all

<a href = "./bt-sager.php" style = "text-decoration:none;" target = "_blank"><b><font color = "#FF0000" face = "Tahoma" size = "4"><script src = "./bt-sager-wc.php"></script></font></b></a></p>
refuses to show a thing on my index.htm page. just totally blank.

I then thought why not use

Code: Select all

<?php include('./bt-sager-wc.php');?>
I then reformated the last line like so:

Code: Select all

//echo "document.write ('$sf');";
echo "$sf";
I then had an issue with the php code being commented out by the server!!!. <!-- --> a quick google search shows I needed to add the following into my .htaccess file

Code: Select all

AddType application/x-httpd-php .html .htm
it now works as intended!

https://www.conligwx.org/cmx/index.htm
Regards Simon

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

Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: BT's Sager PHP Script V2 - For Cumulus

Post by beteljuice »

You do realise that:
.htaccess file

Code: Select all

AddType application/x-httpd-php .html .htm
Means that all htm / html files from that directory down can execute php without having to have .php extension ?

Something seems to have changed, because when I tried your bt-sager-wc.php before it did NOT give the forecast in any 'style' but it DID give what should have been the (html) commented out debug stuff as page content ???

<!-- bt-sager-wc loaded -->
<!-- server running PHP ver 7.4.7 -->
<!-- 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 EGAC -->
<!-- METAR OK -->

All very odd.
Image
......................Imagine, what you will KNOW tomorrow !
Mapantz
Posts: 1776
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by Mapantz »

Try this in .htaccess

Code: Select all

<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
</IfModule>
Image
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by HansR »

Tbh: if users must start editing their htaccess to accomplish things, I think that is not OK and it should not be propagated by any support but to some specialised users. Htaccess is a sensitive tool and as far as I can see, most users are not fit to meddle with it creating moore problems than they solve.
But OK, that's only IMHO.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
Mapantz
Posts: 1776
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by Mapantz »

HansR wrote: Sun 28 Jun 2020 5:48 am Tbh: if users must start editing their htaccess to accomplish things, I think that is not OK and it should not be propagated by any support but to some specialised users. Htaccess is a sensitive tool and as far as I can see, most users are not fit to meddle with it creating moore problems than they solve.
But OK, that's only IMHO.
It's a universal way of getting PHP to work in .htm and .html pages. It's either that, or you change your files to .php

Whether you think it's ok or not, is irrelevant.
Image
User avatar
HansR
Posts: 5871
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by HansR »

Mapantz wrote: Sun 28 Jun 2020 10:11 am Whether you think it's ok or not, is irrelevant.
:lol: I am fully aware of that, but it does not stop me from expressing me. You never know...
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by mcrossley »

Though of course rather than globally processing all htm(l) files as beteljuice pointed out, it may better to just enable it for the one file - index.htm in this case?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: BT's Sager PHP Script V2 - For Cumulus

Post by beteljuice »

I just remembered ...
Simon wrote:... with PHP 7.4.7 ...
I wonder if the strange response to the script call (mime-type) is something 'new' to watch out for :(
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by mcrossley »

beteljuice wrote: Mon 29 Jun 2020 12:34 am I just remembered ...
Simon wrote:... with PHP 7.4.7 ...
I wonder if the strange response to the script call (mime-type) is something 'new' to watch out for :(
If you have strict MIME type enforcement, yes - though I think it is a web server thing rather than PHP?
I would try changing the <script> HTML to load a .js file (thus keeping the JS MIME type correct)...

Code: Select all

<script src = "./bt-sager-wc.js"></script>
Then add a translation in the .htaccess from the js to php file - which would then be passed to the PHP processor without any requirement for further fiddling in the .htaccess file.

Code: Select all

RewriteEngine On
RewriteRule bt-sager-wc.js$    bt-sager-wc.php [NC,L]
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: BT's Sager PHP Script V2 - For Cumulus

Post by beteljuice »

Edit: 13 Dec 2020 - BTJ is back on board and has a new release available on the original topic (link lower down)
BTJ wrote:Version 2020-12-12 is now live. It is attached to the bottom of the first post in this thread.
I have no idea if there is any compatibility beteween the versions - It would be best to assume not !!!
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
Buford T. Justice
Posts: 423
Joined: Fri 17 Aug 2012 9:21 pm
Weather Station: Ecowitt GW1002
Operating System: Windows 11 Pro
Location: USA

Re: BT's Sager PHP Script V2 - For Cumulus

Post by Buford T. Justice »

The beteljuice was busy while I was away. Thanks for your hard work while I was away.
TheBridge
Posts: 115
Joined: Mon 16 Mar 2020 3:23 am
Weather Station: Davis
Operating System: Windows 10
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by TheBridge »

BTJ,

Near novice here. Is Sager solid enough to use? I tired it and got nothing really:
Climate.tommueller.com
Thanks,
Bridge on LA area
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by water01 »

Works perfectly as you can see here https://www.dmjsystems.co.uk/weatherbos/index.php but your problem is that if you do an F12 to load the page you are getting a 404 on bt-sager-wc.php which means you have not followed the instructions correctly and uploaded al of the code required as that does not exist on your server.
David
Image
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by water01 »

And here it is working in a CMX website

Image
David
Image
TheBridge
Posts: 115
Joined: Mon 16 Mar 2020 3:23 am
Weather Station: Davis
Operating System: Windows 10
Contact:

Re: BT's Sager PHP Script V2 - For Cumulus

Post by TheBridge »

Water01 (David), files copied from server attached.
I don't see what's missing...but hoping something is to clear up this mystery.
You do not have the required permissions to view the files attached to this post.
Post Reply