Web Page full of Errors

edit settings.php

I found this:

SITE[‘tz’] = ‘America/New_York’; //NOTE: this MUST be set correctly to
// translate UTC times to your LOCAL time for the displays.
// http://us.php.net/manual/en/timezones.php has the list of timezone names
// pick the one that is closest to your location and put in $SITE[‘tz’] like:
// $SITE[‘tz’] = ‘America/Los_Angeles’; // or
// $SITE[‘tz’] = ‘Europe/Brussels’;
// note: date format used for PHP parts only. Weather software dates are not processed
// except on the astronomy page

Looks like the line that has America/Los_Angeles should be something on my coast - like New_York - AND IF I read correctly the line itself is commented so I need to take out the “//”

Think that would help?

In settings.php its complaining about line 104:

$SITE[‘copyr’] = '© ’ . date(“Y”,time()) . ‘, www.deputydawgwx.com’;

Looking again I did set it to NY

############################################################################

Sitewide configuration - Station location, identity and date/time info

############################################################################

$SITE[‘organ’] = ‘DeputyDawgWx’;
$SITE[‘copyr’] = '© ’ . date(“Y”,time()) . ‘, www.deputydawgwx.com’;
$SITE[‘location’] = ‘DeKalb County, Georgia USA’;
$SITE[‘email’] = ‘mailto:[email protected]’;

Station location: latitude, longitude, cityname

$SITE[‘latitude’] = ‘33.8102230’; //North=positive, South=negative decimal degrees
$SITE[‘longitude’] = ‘-84.3486610’; //East=positive, West=negative decimal degrees
$SITE[‘cityname’] = ‘DeKalb County’;

$SITE[‘tz’] = ‘America/New_York’; //NOTE: this MUST be set correctly to
// translate UTC times to your LOCAL time for the displays.
// http://us.php.net/manual/en/timezones.php has the list of timezone names
// pick the one that is closest to your location and put in $SITE[‘tz’] like:
// $SITE[‘tz’] = ‘America/Los_Angeles’; // or
// $SITE[‘tz’] = ‘Europe/Brussels’;
// note: date format used for PHP parts only. Weather software dates are not processed
// except on the astronomy page

$SITE[‘timeFormat’] = ‘D, d-M-Y g:ia T’; // Day, 31-Mar-2006 6:35pm Tz (USA Style)
//$SITE[‘timeFormat’] = ‘m/d/Y g:ia’; // USA format 03/31/2006 14:03
//$SITE[‘timeFormat’] = ‘d/m/Y H:i’; // Euro format 31/03/2006 14:03
//$SITE[‘timeFormat’] = ‘Y-m-d H:i’; // ISO format 2006-03-31 14:03

$SITE[‘timeOnlyFormat’] = ‘g:ia’; // USA format h:mm[am|pm
//$SITE[‘timeOnlyFormat’] = ‘H:i’; // Euro format hh:mm (hh=00…23);
$SITE[‘dateOnlyFormat’] = ‘d-M-Y’; // for 31-Mar-2008 or ‘j/n/Y’ for Euro format

But you set it after you need it set for php date/time:

############################################################################

Sitewide configuration - Station location, identity and date/time info

############################################################################

$SITE[‘organ’] = ‘DeputyDawgWx’;
$SITE[‘copyr’] = '© ’ . date(“Y”,time()) . ‘, www.deputydawgwx.com’;
$SITE[‘location’] = ‘DeKalb County, Georgia USA’;
$SITE[‘email’] = ‘mailto:[email protected]’;

Station location: latitude, longitude, cityname

$SITE[‘latitude’] = ‘33.8102230’; //North=positive, South=negative decimal degrees
$SITE[‘longitude’] = ‘-84.3486610’; //East=positive, West=negative decimal degrees
$SITE[‘cityname’] = ‘DeKalb County’;

$SITE[‘tz’] = ‘America/New_York’; //NOTE: this MUST be set correctly to
// translate UTC times to your LOCAL time for the displays.
// http://us.php.net/manual/en/timezones.php has the list of timezone names
// pick the one that is closest to your location and put in $SITE[‘tz’] like:
// $SITE[‘tz’] = ‘America/Los_Angeles’; // or
// $SITE[‘tz’] = ‘Europe/Brussels’;
// note: date format used for PHP parts only. Weather software dates are not processed
// except on the astronomy page

I’m confused…

What I have is the same as what you have. The $site[‘copy’} line

Here is a screen shot of the code with line numbers. It looks the same as what you pasted

Do you have a screen shot of how yours looks perhaps?


Screen Shot 2018-10-07 at 6.49.53 PM.png

Sorry, let me try that again…

On line 104 you are using the php data/time functions to get the date which is used to display the copyright date on your webpage.

$SITE[‘copyr’] = '© ’ . date(“Y”,time()) . ‘, www.deputydawgwx.com’;

php is complaining because it doesn’t allow you to use that function without setting the timezone, and you only do that later later in the settings.php at line 334 (although you do define the time zone on line 112).

Try changing 104 to

$SITE[‘copyr’] = '© ‘2018, www.deputydawgwx.com’;

cut/pasted your line 104

now i get:

Parse error: syntax error, unexpected ‘2018’ (T_LNUMBER) in /home4/paul/public_html/Settings.php on line 104

So I put back to how it was. I’m also confused how this happened. Nothing I would have done to change this. Was working fine a few days ago, last I checked.

On second thought I did get an email from host site a few days ago that my PW was changed on my site (around midnight while I was fast asleep). I logged in and changed it.
Wonder if someone went in and changed this? who and why is a mystery

My guess is that they updated the version of php.

I will give them a call tomorrow

Hopefully Ken is reading this. When I logged on to his site with the templates, his code looks different
Instead of Los_Angeles he had PST8PDT

Otherwise, i’m clueless.

Thanks none the less for looking at this

One more then I have to run:

$SITE[‘copyr’] = ‘© 2018, www.deputydawgwx.com’;

WOW that FIXED Everything !!!

Question… do I have to change this on Jan 1 to be 2019?

Any thoughts as to what happened? I swear i never changed anything.

Gotta go now but I’ll figure that out before new year :lol:

I really think the version of php changed, this issue would only arise with later versions.

Use the code from Ken’s template settings.php, it uses gmdate which defaults to GMT so it doesn’t depend on the time zone setting.

$SITE['copyr']			= '© ' . gmdate("Y",time()) . ', Your Weather Website';

Change the line in Settings.php from

$SITE[‘copyr’] = '© ’ . date(“Y”,time()) . ‘, www.deputydawgwx.com’;

to

$SITE[‘copyr’] = '© ’ . gmdate(“Y”,time()) . ‘, www.deputydawgwx.com’;

to eliminate the warning. The timezone is not set until later in Settings.php, but gmdate() is good to use anywhere.

Just curious… :?

Why not move the setting of the timezone [ie: ‘date_default_timezone_set()’] up into the configuration file (before any of the date-related functions are used) rather than relying on the ‘gmdate()’ function as a ‘bandage’ solutions… :roll:

More likely, in a (near) future version of PHP, the ‘gmdate()’ function will be displaying the same warning situation that the ‘date()’ function is now displaying… :-k

gmdate will never display a warning as, per definition, all times in PHP are UTC. So gmdate is always correct everywhere with any server, regardless of the server time-zone.
The only drawback is the few hours every new-year that the year in the copyright notice is off for the timezone difference. Somewhere there will be a webserver to early displaying next year. 11 or 12 hours before the real new year.
Someone will notice that and post a message here on the forum :smiley:
Wim

Wim’s correct – gmdate() will always work irrespective of date_default_timezone_set() being done or not. He’s also correct about the year-change display will be early for some/late for others :slight_smile:

Ray… to answer your question about “Why not move the setting of the timezone [ie: ‘date_default_timezone_set()’] up into the configuration file…”

The Settings.php in the Saratoga template is ‘supposed’ to have just settings in the top part (for the website owner to adjust as needed) followed by code to act on those settings at the bottom. The only exception to that was the copyright date automatically done as part of a setting. The gmdate() change makes it work without having to embed a date_default_timezone_set earlier in the page. That keeps configuration:execution placement in the file as it’s been since the templates were released.

I think it’s fine as it is, but as far as I can find it’s only used in footer.php so settings.php could just define the website name and then footer.php could use a regular date expression.

In hindsight, you’re correct Niko. I’d done the templates originally to have the year (via the gmdate()) be part of the copyright info in Settings.php so folks could elect to have/not have a copyright by just changing one setting. It is only used in footer.php.

I don’t tend to update the master Settings.php since it would be included in updates (via the updates.php) and people hate to redo all their customizations for that file.