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

Monthly records page with PHP tags.

Please discuss beta versions of Cumulus 1 here. Note: There are currently no beta versions of Cumulus 1.
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: Monthly records page with PHP tags.

Post by beteljuice »

Actually, that's just reminded me, it's one of the many things that I need to point to my new server host, everythings being 'double mapped' at the moment (but not all things work, because some of the server paths have changed :bash: )
Image
......................Imagine, what you will KNOW tomorrow !
duke

Re: Monthly records page with PHP tags.

Post by duke »

I agree too, I was just curious ;) .

Duke
duke

Re: Monthly records page with PHP tags.

Post by duke »

That's better. Image
... because I decided to give Lady beteljuice her garden back and removed my 30' anemometer mast !
May be she would consider letting you have a smaller one............

Duke
duke

Re: Monthly records page with PHP tags.

Post by duke »

So what's happening (or not) here :? ...........?

Finally got 10 mins to get back to this today, as I nearly had the page completed for Graemes webtags I've stayed with that for now but will implement Rays method when time allows.

Anyway, here is the page working, and here is the script and table cut n paste into one of my template pages with

Code: Select all

onload="changeData(<?php echo $month; ?>-1);"
added to the body tag but no data shows. I also notice that the js clock no longer appears on this page with the script added..... :?

Duke
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: Monthly records page with PHP tags.

Post by beteljuice »

You have changeData() in <body onload .........

Wonderfull CSS is one of the last things to be applied to a page, so the function can't "see" the ids it's trying to populate.

Put it as a seperate JS one-liner just before your closing </body> tag - should be OK ;)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Monthly records page with PHP tags.

Post by mcrossley »

Your page does not display any data because there is none to display! All your array declarations in the javascript code are empty. So there is a problem in your PHP code somewhere which isn't adding the data to the page.
duke

Re: Monthly records page with PHP tags.

Post by duke »

Mark - I believe the PHP to be fine as I've just cut n paste from the working page into my template.

Beteljuice - at best my JS is extremely limited, what would be the one-liner I need to add?

Duke
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: Monthly records page with PHP tags.

Post by beteljuice »

Code: Select all

.....

<script type="text/javascript">
   changeData(<?php echo $month; ?>-1);
</script>

</body>

Image
......................Imagine, what you will KNOW tomorrow !
duke

Re: Monthly records page with PHP tags.

Post by duke »

beteljuice wrote:.....

Code: Select all

<script type="text/javascript">
   changeData(<?php echo $month; ?>-1);
</script>

</body>

Thanks beteljuice, that's actually what I had put in some where in the small hours of the morning but it still didn't work :bash: .

It is now how ever :shock: Turns out there were 2 issues, after I deleted everything not needed on the page and ran both through beyond compare.

1/ As beteljuice pointed out the code needed moving from the body tag to allow the script to run and to allow other scripts on the page to run. Having the code in the body tag stopped the clock scripts.

2/ @Mark, my apologies to you, you were also correct but I just could not see why. It was having the

Code: Select all

  <?php
  require_once("uploads/monthalltimewebtags.php");
  ?>
below the list of scripts. Moving this from below the list of js scripts on the page to above them allowed it to work. I assume the script was being run before the tags were processed and therefore no data to post.

Am I correct in my thinking???

My thanks to you both.

Duke
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Monthly records page with PHP tags.

Post by gemini06720 »

Duke something I have found out over the past years is that all the PHP code that is in use on a page should be processed before anything else - well, the PHP processor/compiler on the server has to get and process its data before that data can be used anywhere else.

It has also been my experience over the past months that the AJAX/JavaScript code should be processed as late as possible thus I now place (almost all of) the JavaScript at the bottom of the page or I use the 'defer="defer"' option when calling/loading the JavaScript - remember, the page has to be drawn with all its data/graphics before it can be updated, thus 'pushing' the download and start of the JavaScript on the user's computer for as late as possible - so far, it has been working well with the scripts/templates I have been working on.
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Monthly records page with PHP tags.

Post by mcrossley »

Ray, you probably know, but the reason to put the scripts at the end of the page is because loading and parsing a script is a 'blocking' action on the browser - it pauses all other downloads and page rendering while it downloads and parses each script. There are some ways around this, but they involve tricks like the defer (which doesn't work in all browsers) and dynamic loading.
Locked