sparkynerd wrote:...I tend to agree with not disabling error reporting, as its sort of a "band-aid."
Good decision - as you wrote, deactivating the reporting of errors/warnings by PHP is a really poor technique in dealing with poorly written PHP scripts and designers too lazy to make their code error free.
And no one will ever learn anything about PHP if errors/warnings are not displayed and the code producing those same errors/warnings is not corrected to, not just hide the errors/warnings, but eliminate those errors/warnings.
I always try to reverse engineer the code and figure out the problem that way...
This is your only way to learn something about PHP. You must also make good use of the documentation from the PHP which can be downloaded from the
PHP website in the '.chm' Windows compatible help file - I suggest that you download the larger size 'Help file (with user notes)' as it is nice to see all those examples/suggestions by many users.
You might also want to have a look at the
W3Schools web site - a good place with good references and many tutorials.
I am using the stock template with no custom code... yet...
Well, I installed a new copy of the templates and did some basic settings. Unfortunately, I could not reproduce the errors. I looked at the function 'moonphase' (starting at line # 1148); I looked at the locations where that function is called (or used) (at lines # 835 and 841); I then looked at the location where the variable '$moonage' comes from (is produced); since you are probably using Cumulus to produce the data files required by the templates, the variable '$moonage' is created at line # 285 but, indeed, there is a 'but' the variable '$moonage' is only created if it does not already exists, meaning that another script has not already produced a variable with the name '$moonage'. YOu can easily check for that possibility by temporarily inserting a new line of code, such as:
Code: Select all
if(!isset($moonagedays)) {$moonagedays = $mooninfo->pic; }
if(!isset($moonage)) {$moonage = 'Moon age: '.$mooninfo->age.','.$mooninfo->ill.'%'; }
to:
Code: Select all
if(!isset($moonagedays)) {$moonagedays = $mooninfo->pic; }
echo '<br>isset($moonage) == '.(isset($moonage)?'true':'false'); // new/temporary line
if(!isset($moonage)) {$moonage = 'Moon age: '.$mooninfo->age.','.$mooninfo->ill.'%'; }
Note: Before editing any script, make sure you make a backup copy of that script.
Once that line has been added and the script has been save, using your browser, call the 'ajax-dashboard.php', such as:
Code: Select all
http://localhost/weather3/ajax-dashboard.php
If the variable '$moonage' has
not already been created by another script, on the top left side of the display, you should see the following:
If the display shows:
then you know a setting somewhere or another script is creating the variable '$moonage' and possibly putting a value into it.
This ends 'Part One' of the 'reverse engineering' of the code of the 'ajax-dashboard.php' script...