Page 1 of 1

URL options for Trends Page.

Posted: Thu 30 Apr 2020 1:50 am
by Phil23
I'm sure I'd read this before, but having no luck with searches.

It is possible I assume to specify a Chart type for the Trends.htm page?

Much like with Beteljuice's dayfile readers http://weather.inverellit.com/datasumma ... a=rainfall

Tried a few things as well & not hitting the right thing.

Thanks

Phil

Re: URL options for Trends Page.

Posted: Thu 30 Apr 2020 2:28 am
by beteljuice
If you mean change the default chart ...

Top of cumuluscharts.js

Code: Select all

$(document).ready(function () {    
    $.ajax({url: "graphconfig.json", dataType:"json", success: function (result) {
            config=result;
			doTemp();
			changeImage(window.location.href.split('?')[1]);
            
        }});
});
Change DoTemp(); to whatever your heart desires ...

@mark, It says you moderate this twice :shock:

Re: URL options for Trends Page.

Posted: Thu 30 Apr 2020 4:40 am
by Phil23
beteljuice wrote: Thu 30 Apr 2020 2:28 am If you mean change the default chart ...
No I don't want to change default chart, but send a URL that will go directly to the rainrall page in say an email.
http://weather.inverellit.com/graphs.htm [rain or whatever here]

Similar to how I can send.....
http://weather.inverellit.com/datasumma ... a=rainfall
and the link opens the rain page instead of the default Max Temp page.


Phil

Re: URL options for Trends Page.

Posted: Thu 30 Apr 2020 6:47 am
by beteljuice
You would have to make the page .php

Then write some php code to look for posted request, and then that 'writes' javascript to execute changeGraph("postedchoice");

... but you would have to ensure charts has loaded before execution.

something like this toward the bottom of your page ..

Code: Select all

<?php

if(isset($_REQUEST['type'])) {
echo "
<script>
function waitforit() {
	if (!typeof changeGraph === \"function\") {
 		setTimeout( waitforit, 200);
		return;
	}
	changeGraph('".$_REQUEST['type']."');
}
waitforit();
</script>
";
};
?>
usage would be: graphs.php?type=rain

UNTESTED - might crash and burn :roll:

Re: URL options for Trends Page.

Posted: Thu 30 Apr 2020 8:17 am
by mcrossley
beteljuice wrote: Thu 30 Apr 2020 2:28 am @mark, It says you moderate this twice :shock:
So good they list me twice!
No idea, I'm not a forum admin. @freddie?

Re: URL options for Trends Page.

Posted: Thu 30 Apr 2020 9:00 am
by water01
Not a problem Mark, just ignore it, a permissions glitch. Take a look at all the forums in Web Development and you will see exactly the same.

Re: URL options for Trends Page.

Posted: Mon 04 May 2020 3:50 am
by Phil23
beteljuice wrote: Thu 30 Apr 2020 6:47 am You would have to make the page .php
As I understand, I can simply rename the htm file to php & it would need no initial changes to still work.
Then add some php code later...

Then create an entry in the extra webfiles etc.......

That does bring me to a though I've always had about MX having an option to "Upload Standard files as PHP".
I'd assume with the right settings on the host, a users site could then have ALL the standard files uploaded with a php extension & then make the additional changes in their original indexT.htm etc files, but not be required to setup the 10 standard files under extra webfiles.

Phil.

Re: URL options for Trends Page.

Posted: Mon 04 May 2020 4:46 am
by beteljuice
you wrote:As I understand, I can simply rename the htm file to php & it would need no initial changes to still work.
Then add some php code later...
Correct ..
MX having an option to "Upload Standard files as PHP".
Is that a wish list thing ?