Author Topic: what did i miss  (Read 1024 times)

0 Members and 1 Guest are viewing this topic.

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
what did i miss
« on: July 26, 2015, 03:40:51 PM »
HI All,
I am Stuck

it is not using the settings in the settings in the file
http://n9mfk.info/newidea/mydata/todayyesttemp.php
code in page
Code: [Select]
$path =  $_SERVER['DOCUMENT_ROOT'];
$WXtags = 'CUtags2.php';
$CurrentFilename = $path.'/'.$WXtags;  // current PHP variable file


require_once('../Settings.php');
require_once("./common.php");

// overrides from Settings.php if available
global $SITE;

if (isset($SITE['path'])) {$path = $SITE['path'];}
if (isset($SITE['WXtags'])) {$WXtags = $SITE['WXtags'];}



code in Settings.php
Code: [Select]
$SITE['path'] = $_SERVER['DOCUMENT_ROOT'];
$SITE['WXtags'] = '../CUtags.php';   

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: what did i miss
« Reply #1 on: July 26, 2015, 08:09:19 PM »
Your todayyesttemp.php

require_once('../Settings.php');

should likely be

require_once('./Settings.php');

I doubt you have your main file stored one directory up from that page.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
Re: what did i miss
« Reply #2 on: July 26, 2015, 09:12:54 PM »
Hi Ken,
here the layout
/public_html/newidea/mydata/todayyesttemp.php

/public_html/newidea/Settimgs.php

so would that be .. ?


did I  miss something here
Code: [Select]
<?php
error_reporting
(E_ALL);
ini_set("display_errors"1);
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (Base-USA template set)
############################################################################
#
# Project: Sample Included Website Design
# Module: Settings.php
# Purpose: Provides the Site Settings Used Throughout the Site
Authors: Kevin W. Reed <kreed@tnet.com>
# TNET Services, Inc.
#
Copyright: (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
# This document uses Tab 4 Settings
############################################################################
//Version 1.01 - 28-Jul-2012 - added support for nws-alerts scripts
$SITE  = array();

############################################################################
# Sitewide configuration - website style and features
############################################################################

#---------------------------------------------------------------------------
#  required settings for Cumulus software
#---------------------------------------------------------------------------

$SITE['path'] $_SERVER['DOCUMENT_ROOT'];
$SITE['extratags'] ='extratags.php';
$SITE['cumuluswebtagsRealtime'] ='cumuluswebtagsRealtime.php';
$SITE['WXtags'] '../CUtags.php';    // for weather variables
$SITE['ajaxScript']     = 'ajaxCUwx.js';   // for AJAX enabled display
$SITE['realtimefile']   = '../realtime.txt';  // directory and name of Cumulus realtime.txt file
$SITE['graphImageDir']  = '../images/';     // directory location for graph images with trailing /
#---------------------------------------------------------------------------
$SITE['DavisVP'] true;  // set to false if not a Davis VP weather station
$SITE['UV'] false;  // set to false if no UV sensor
$SITE['SOLAR'] false;  // set to false if no Solar sensor
#
##########################################################################
# end of configurable settings#
#
// if your software uploads almanac dates using a language OTHER THAN English, please put the month
// names in your language to replace the English ones below.  This is used primarily by the
// wxastronomy.php page for the local dates of moon phases, solistices, and equinoxes
$SITE['monthNames'] = array(  // for wxastronomy page .. replace with month names in your language 
'January','February','March','April','May','June',
'July','August','September','October','November','December'
);
// example:
//$SITE['monthNames'] = array(  // Danish for wxastronomy page .. replace with month names in your language
//'januar','februar','marts','april','maj','juni',
//'juli','august','september','oktober','november','december'
//);

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

$SITE['organ'] 'n9mfk\'s Weather';

$SITE['copyr'] '&copy; ' date("Y",time()) . ', n9mfk\'s Weather';
$SITE['location']       = 'Springfield, IL, USA';
$SITE['email'] 'mailto:n9mfk9@gmail.com';
# Station location: latitude, longitude, cityname
$SITE['latitude'] '39.706194';    //North=positive, South=negative decimal degrees
$SITE['longitude'] '-89.631444';  //East=positive, West=negative decimal degrees
$SITE['cityname'] 'Springfield';

$SITE['tz' 'America/Chicago'//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['timeFormat'] = 'D, d-M-Y H:i T';  // Day, 31-Mar-2006 6:35pm Tz  (USA Style)

//$SITE['timeOnlyFormat'] = 'g:ia';          // USA format h:mm[am|pm\
$SITE['timeOnlyFormat'] = 'H:i';          // Euro format hh:mm  (hh=00..23);
$SITE['timeOnlyFormat2'] = 'g:i A';          // USA format h:mm[AM|PM\
//$SITE['timeOnlyFormat2'] = '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
$SITE['dateOnlyFormat2'] = 'l, d M Y';        // for day of the week + 31-Mar-2008 or 'j/n/Y' for Euro format

############################################################################
# Sitewide configuration - support scripts configuration
############################################################################

###########################################################################
# These values should reflect the units-of-measure your weather station
# uses to report the weather data when processing weather tags.
# Note: if you change them here, make sure to make the corresponding
#   changes in the ajax[WXname]wx.js AJAX script also.
###########################################################################

$SITE['WDdateMDY'] = true// for WD date format of month/day/year.  =false for day/month/year


##
# set the Timezone abbreviation automatically based on $SITE['tzname'];
# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
 putenv("TZ=" $SITE['tz']);
//  print "<!-- using putenv(\"TZ=". $SITE['tz']. "\") -->\n";
    
} else {
 date_default_timezone_set($SITE['tz']);
//  print "<!-- using date_default_timezone_set(\"". $SITE['tz']. "\") -->\n";
   
}

$SITE['tzname'] date("T",time());

# Automatic Info we might need
############################################################################
if(isset($_SERVER['REMOTE_ADDR']))   {$SITE['REMOTE_ADDR'] $_SERVER['REMOTE_ADDR'];}
if(isset(
$_SERVER['REMOTE_HOST']))   {$SITE['REMOTE_HOST'] $_SERVER['REMOTE_HOST'];}
if(isset(
$_SERVER['DOCUMENT_ROOT'])) {$SITE['WEBROOT'] $_SERVER['DOCUMENT_ROOT'];}
if(isset(
$_SERVER['REQUEST_URI']))   {$SITE['REQURI'] $_SERVER['REQUEST_URI'];}
if(isset(
$_SERVER['SERVER_NAME']))   {$SITE['SERVERNAME'] $_SERVER['SERVER_NAME'];}
$SITE['remote'] "onclick=\"window.open(this.href,'_blank');return false;\"";
$SITE['PHPversion'] = phpversion();

?>

« Last Edit: July 26, 2015, 09:37:35 PM by n9mfk9 »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: what did i miss
« Reply #3 on: July 27, 2015, 07:06:57 PM »
Beau,

You just need to understand what the current working directory is for a script when loaded.

When the /newidea/mydata/todayyesttemp.php script loads, it's current working directory is
public_html/newidea/mydata/

when it executes require_once('../Settings.php');
the Settings.php will also share the same working directory (public_html/newidea/mydata/) (assuming that there is a Settings.php in public_html/newidea/ directory, that is).

The value for $_SERVER['DOCUMENT_ROOT'] should always be (for you) your public_html/ directory (I've omitted the rest of the forward path which could be /usr/home/userid/ and depends on your host)

Using the ./ means 'from the current working directory'
Using the ../ means 'from one directory up the path from the current working directory'

Your unique combination of scripts placed in various parts of the document tree will demand you really get the relative file addressing correct, and you have to remember that a script include()/require() causes the included script to have the calling script's current working directory assigned (and that may not be what you expect).


Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
Re: what did i miss
« Reply #4 on: July 28, 2015, 08:37:22 AM »
Hi Ken
I did some test no mater where the file was
this is not be used
Code: [Select]
if (isset($SITE['WXtags'])) {$WXtags = $SITE['WXtags'];}
it is using
Code: [Select]
$WXtags = 'CUtags2.php';
I do not see why

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: what did i miss
« Reply #5 on: July 28, 2015, 01:36:07 PM »
If the Settings.php AND it's load of Settings-weather.php can't be loaded, then the $SITE['WXtags'] value won't be set.

It is your directory structure that is causing you trouble.  You must understand HOW relative addressing works in order to accommodate a complex, multi-directory PHP loading structure.

Simplify by putting all the stuff in one directory (or at most a main and a 'test' directory).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
Re: what did i miss
« Reply #6 on: July 28, 2015, 03:15:23 PM »
Hi Ken,
look at the files in the zip
 see if you see a problem
thanks Beau

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: what did i miss
« Reply #7 on: July 28, 2015, 04:05:55 PM »
Settings.php AND Settings-weather.php have to be in the same directory otherwise Settings.php can't auto-load Settings-weather.php for you.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
Re: what did i miss
« Reply #8 on: July 28, 2015, 04:22:47 PM »
Ken,
for what I am doing I wanted to just use 1 file i thought i had removed every thing for settings-weather what did i miss?
Beau

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: what did i miss
« Reply #9 on: July 28, 2015, 04:55:15 PM »
Beau,
As much as I enjoy our interactions, I must say that I'm not your personal code debugger.  While I endeavor to help those who have issues setting up and operating my scripts, I don't really want to do individual code debugging for others for their personally developed scripts -- that's for the script author (you) to figure out.

The fun of this hobby should be in the learning and doing more with what you learn.  I have given you the 'clues' about how the template works (and that it generally expects to be in a 'flat' environment).  When you choose to change the flat environment to a multiple subdirectory environment, things will break unless you are very careful with your relative file addressing inside your scripts.

In short, I'm not going to fix your problem for you -- you created it by using multiple subdirectories.  Use your knowledge of relative file addressing to fix it yourself.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n9mfk9

  • Contributor
  • ***
  • Posts: 112
Re: what did i miss
« Reply #10 on: July 28, 2015, 05:56:30 PM »
Hi Ken thanks For the info I was not asking for it to be fixed i find after  working on code some times with my bad
eyes lead me to miss small things
Thanks beau

 

anything