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 4019) - 03 April 2024

Legacy Cumulus 1 release 1.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

Changing Date Format in include-NOAA-reports.php?

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Changing Date Format in include-NOAA-reports.php?

Post by William Grimsley »

Hi Ken,

Is it possible, to change the date format on the line ABOVE the NOAA Report files?

e.g. from 2013 Feb to Feb 2013 or 02/2013?

I tried changing:

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $now_year ".$longmonths[$now_month]."</b>\n";
To

Code: Select all

echo "<br /><b>".langtransstr('Report for').".$longmonths[$now_month]." $now_year</b>\n";
But, the file didn't do what I THOUGHT it was going to do... :bash:

Please help,

Thanks

William
Last edited by William Grimsley on Wed 27 Feb 2013 3:49 pm, edited 1 time in total.
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by water01 »

William, don't you think it is about time you invested in a PHP course?

Randomly changing around php code and expecting people to fix it for you, especially Ken who seems to have the patience of a saint, is not on.

If you look carefully at the code lines (especially the pairing of double quotes and the positioning of the full stops) it is quite obviously why the new line of code will fail php syntax checking.
David
Image
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by William Grimsley »

Well, no. I'm 14, so I can't go on a PHP course...
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by water01 »

What has age got to do with it, my son learnt it at 11. You are on a computer, you have access to the internet, so here is a free step by step tutorial that will teach you the basics http://www.w3schools.com/php/default.asp.
David
Image
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by William Grimsley »

water01 wrote:What has age got to do with it, my son learnt it at 11. You are on a computer, you have access to the internet, so here is a free step by step tutorial that will teach you the basics http://www.w3schools.com/php/default.asp.
Hi David,

Ok, I'll take a look at that link, later.

What I was on about is, going to an actual PHP class. But, if I can learn it on the internet that's great! :D

Thanks for the link,

William
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by water01 »

There are also quite a lot of books. This one is not expensive http://www.computermanuals.co.uk/script ... motion=REC and is suitable for someone initially learning PHP and also teaches you how to interact with MySQL databases.
David
Image
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in incllude-NOAA-reports.php?

Post by William Grimsley »

Hi David,

Thanks for the book, too. I think I'll stick to the link for now.

Thanks again,

William
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by William Grimsley »

Arrrrggghhhh! I can't do this! :cry: :bash:
Last edited by William Grimsley on Wed 27 Feb 2013 7:22 pm, edited 3 times in total.
RayProudfoot
Posts: 3389
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by RayProudfoot »

William,

If you're frequently asking for help on PHP it suggests you're trying to run before you've learned to walk - or crawl. ;)

We were all novices in various skills once. You'll find it far more satisfying learning to write and change PHP than asking others for the answers.

The link provided by David looks like an excellent starting point. I want to learn PHP too once I've retired and I think a book is far preferable to an on-line course although both are useful in their own ways.
Cheers,
Ray, Cheshire.

Image
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by William Grimsley »

Well, I never! I've fixed it!

I found that in the wxnoaaclimatereports.php file, it was including the NOAA-reports.php file and not the include-NOAA-reports.php file, so for a start, I was actually editing a file that wasn't even being included in the wxnoaaclimatereports.php file, in the first place! :oops:

Then, I changed the include-NOAA-reports.php file from:

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $yr "; echo isset($longmonths[$mo])?$longmonths[$mo]:''; echo "</b>\n;
To

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $months[$mo] ".$yr."</b><br />\n";
Then, the include-NOAA-reports.php file, displayed what I wanted. :D
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Changing Date Format in include-NOAA-reports.php?

Post by gemini06720 »

Really, William, you should take some time off of the modifications and start learning PHP... :roll:

You have modified the following line (which is really three lines of code):

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $yr "; echo isset($longmonths[$mo])?$longmonths[$mo]:''; echo "</b>\n;
to:

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $months[$mo] ".$yr."</b><br />\n";
Do you have any idea why the 'isset' function was there in the first instance!

'isset' is there to test if the array '$longmonths[$mo]' is set and is not 'null':
  • - If the array is not set (or is 'null'), then the 'echo' function will display the empty value of ''.
    - If the array is set, then the 'echo' function will display the value of the array '$longmonths[$mo]'.
So, if for any reasons one of the '$mo' (month) value is not set or contains an invalid value, then your modified line will produce a PHP error...

As 'the other' Ray suggested, you should learn to 'crawl' into PHP before continuing even further into your trend to modify (and asking over and over) for help whenever you cannot figure out what to do (or why your modifications are not producing the results you are expecting).

And age has nothing to do with learning PHP - I started learning PHP some 6+ years ago - and I was in my late 50s at that time... :geek:
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by William Grimsley »

gemini06720 wrote:Really, William, you should take some time off of the modifications and start learning PHP... :roll:

You have modified the following line (which is really three lines of code):

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $yr "; echo isset($longmonths[$mo])?$longmonths[$mo]:''; echo "</b>\n;
to:

Code: Select all

echo "<br /><b>".langtransstr('Report for')." $months[$mo] ".$yr."</b><br />\n";
Do you have any idea why the 'isset' function was there in the first instance!

'isset' is there to test if the array '$longmonths[$mo]' is set and is not 'null':
  • - If the array is not set (or is 'null'), then the 'echo' function will display the empty value of ''.
    - If the array is set, then the 'echo' function will display the value of the array '$longmonths[$mo]'.
So, if for any reasons one of the '$mo' (month) value is not set or contains an invalid value, then your modified line will produce a PHP error...

As 'the other' Ray suggested, you should learn to 'crawl' into PHP before continuing even further into your trend to modify (and asking over and over) for help whenever you cannot figure out what to do (or why your modifications are not producing the results you are expecting).

And age has nothing to do with learning PHP - I started learning PHP some 6+ years ago - and I was in my late 50s at that time... :geek:
Oh, dear. Didn't you realise that it actually works in the first instance? :oops:

A PHP Error? http://validator.w3.org/check?uri=http% ... orts%2ephp

I am learning PHP, now. That's how I've managed to do what I've done, because I know how it works! ;)
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by water01 »

William, you haven't read what Ray said!!!! Of course the php will validate but in the circumstances when the month is not set or contains an invalid value the php will generate incorrect code and it will fail.

PHP validation cannot by it's very nature test all circumstances that could occur when testing is made on data, it can only test syntax as it exists with code submitted at validation.

So at some stage in the future if the condition you removed exists your code will fail.
Last edited by water01 on Thu 28 Feb 2013 10:06 am, edited 1 time in total.
David
Image
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Changing Date Format in include-NOAA-reports.php?

Post by gemini06720 »

William Grimsley wrote:Oh, dear. Didn't you realise that it actually works in the first instance?
You are indeed a very obnoxious young man - you need to do a lot of growing up! :evil:

The fact that the page passed the W3C Markup Validation Service means nothing other than the HTML code being sent to the Markup Validation Service meets the W3C standards.

PHP is not checked by the W3C Markup Validation Service - PHP cannot be checked by the W3C Markup Validation Service - PHP is a server-side scripting language - meaning ... the PHP code must first be 'interpreted' by PHP processor module on the Web server before generating the resulting Web page - for your PHP education you might want to have a look at the Wikipedia 'PHP' page (you do know how to read?). :roll:
That's how I've managed to do what I've done, because I know how it works!
You do - do you?!?! :o

If you really knew how PHP work you would not ask all those stupid questions you have been asking after making some modifications to the code ... if you really knew how PHP works, then you would have made no coding error ... you would have no need to ask for assistance ... you would already have all the answers for as all the requests you have made so far... :shock:
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Date Format in include-NOAA-reports.php?

Post by William Grimsley »

Ok, sorry. I'm confused. :oops:
Post Reply