Page 4 of 8

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

Posted: Sat 27 Jun 2020 3:47 pm
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

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

Posted: Sat 27 Jun 2020 5:19 pm
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.

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

Posted: Sat 27 Jun 2020 8:27 pm
by Mapantz
Try this in .htaccess

Code: Select all

<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
</IfModule>

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

Posted: Sun 28 Jun 2020 5:48 am
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.

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

Posted: Sun 28 Jun 2020 10:11 am
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.

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

Posted: Sun 28 Jun 2020 10:14 am
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...

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

Posted: Sun 28 Jun 2020 11:30 am
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?

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

Posted: Mon 29 Jun 2020 12:34 am
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 :(

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

Posted: Mon 29 Jun 2020 10:48 am
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]

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

Posted: Sun 13 Dec 2020 1:31 am
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 !!!

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

Posted: Sun 13 Dec 2020 5:39 am
by Buford T. Justice
The beteljuice was busy while I was away. Thanks for your hard work while I was away.

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

Posted: Thu 19 Jan 2023 11:09 pm
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

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

Posted: Fri 20 Jan 2023 12:48 am
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.

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

Posted: Fri 20 Jan 2023 12:52 pm
by water01
And here it is working in a CMX website

Image

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

Posted: Fri 20 Jan 2023 4:41 pm
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.