If you use Cumulus, please donate Image

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3041 Aug 17 2016. See this post for download

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: 2432
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Monthly records page with PHP tags.

Postby beteljuice » Thu Apr 19, 2012 11:17 am

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 !

User avatar
duke
Posts: 829
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby duke » Thu Apr 19, 2012 3:16 pm

I agree too, I was just curious ;) .

Duke
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
duke
Posts: 829
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby duke » Thu Apr 19, 2012 6:25 pm

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

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
duke
Posts: 829
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby duke » Sun Apr 29, 2012 4:35 pm

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
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
beteljuice
Posts: 2432
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Monthly records page with PHP tags.

Postby beteljuice » Sun Apr 29, 2012 11:11 pm

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: 4692
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby mcrossley » Mon Apr 30, 2012 8:24 am

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.

User avatar
duke
Posts: 829
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby duke » Mon Apr 30, 2012 5:47 pm

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
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
beteljuice
Posts: 2432
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Monthly records page with PHP tags.

Postby beteljuice » Mon Apr 30, 2012 11:01 pm

Code: Select all

.....

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

</body>

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

User avatar
duke
Posts: 829
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby duke » Tue May 01, 2012 6:19 pm

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
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

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

Re: Monthly records page with PHP tags.

Postby gemini06720 » Tue May 01, 2012 10:11 pm

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: 4692
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Monthly records page with PHP tags.

Postby mcrossley » Tue May 01, 2012 10:39 pm

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.


Return to “Cumulus 1 BETA versions”

Who is online

Users browsing this forum: No registered users and 4 guests