Author Topic: NWS Saratoga script done with include statement  (Read 1523 times)

0 Members and 1 Guest are viewing this topic.

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1314
  • BismarckWeather.net
    • BismarckWeather.net
NWS Saratoga script done with include statement
« on: August 07, 2015, 12:05:31 PM »
Short story is I'd like to get rid of the Weather Underground forecast I'm currently using on my homepage and use a shortened version of the Saragota NWS script.  Just something that shows probably the next 3 days or 6 cycles, depending on size.

I've made a http://www.bismarckweather.net/test.html file just as a simple test page before I implement it on my homepage.  But I'm not doing the include statement right.  I've tried a few times about 6 months ago and no good.

My existing forecast is under my /forecast/advforecast2.php location.  I also made another file without some extra html in it as /forecast/advforecastmini.php , but can't get that to work either.

I'm thinking I just have a simple include issue not being coded right.  Anyone have an idea?

Thanks.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Saratoga script done with include statement
« Reply #1 on: August 07, 2015, 12:54:44 PM »
The simple answer is to rename your test.html to test.php

The webserver doesn't know to process .html files with the PHP interpreter -- it uses the extension .php to flag those files that need processing by PHP.
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 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1314
  • BismarckWeather.net
    • BismarckWeather.net
Re: NWS Saratoga script done with include statement
« Reply #2 on: August 07, 2015, 01:07:52 PM »
So if I wanted the script included in my homepage, my homepage would have to be renamed to a PHP file then too?
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Saratoga script done with include statement
« Reply #3 on: August 07, 2015, 01:29:50 PM »
Yes, only pages with .php extension can use PHP code.
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 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1314
  • BismarckWeather.net
    • BismarckWeather.net
Re: NWS Saratoga script done with include statement
« Reply #4 on: August 07, 2015, 02:58:32 PM »
If my forecast is running in a different folder than the root, I'm going to need a second copy of the advforecast2 PHP file in the root, correct?  It seems that was the only way I could make it work.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Saratoga script done with include statement
« Reply #5 on: August 07, 2015, 05:15:26 PM »
My existing forecast is under my /forecast/advforecast2.php location.  I also made another file without some extra html in it as /forecast/advforecastmini.php , but can't get that to work either.

I'm thinking I just have a simple include issue not being coded right.  Anyone have an idea?

A good part of the issues you're having is based on the directory structure the script (advforecast2) expects versus how you have installed it on your site.  As distributed, the script works correctly when it is installed in the document root so the layout looks like:

./advforecast2.php
./DualImage.php
./forecast/icon-templates/*.*
./forecast/images/*.*

You've installed it in
./forecast/advforecast2.php
so when it's included in
./test.php (one directory up), the internal locations for the icons/DualImage.php are incorrect.

I suggest you relocate your advforecast2.php, DualImage.php to your document root, and make sure the ./forecast/images and ./forecast/icon-templates directories have the proper content.  It will be far easier than trying to massage the script's internal references to work in both the document root and in the directory you'd originally installed it in.
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 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1314
  • BismarckWeather.net
    • BismarckWeather.net
Re: NWS Saratoga script done with include statement
« Reply #6 on: August 09, 2015, 03:18:29 PM »
OK, I have a test version of my new homepage in PHP format.  One last question though.  Can I change the font face on text to all Arial and a bit smaller size?

http://www.bismarckweather.net/index-php.php
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Saratoga script done with include statement
« Reply #7 on: August 09, 2015, 05:04:53 PM »
Sure... your page seems to have no default CSS .. the styling is all done with the (archaic) <font face="Arial"...> statements in the HTML itself.

If you change the .htx template from
Code: [Select]
</script>
</head>
to
Code: [Select]
</script>
<style type="text/css">
body {
font-family:Arial, Helvetica, sans-serif;
font-size: 13px;
}
</style>
</head>
then all the entries without a <font...> will be "Arial" in 13px size.
« Last Edit: August 09, 2015, 05:18:10 PM by saratogaWX »
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 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1314
  • BismarckWeather.net
    • BismarckWeather.net
Re: NWS Saratoga script done with include statement
« Reply #8 on: August 09, 2015, 06:24:15 PM »
I didn't notice I missed the dual image PHP file.  Once I brought that down, the font is fine now.

Once I edited the dual icon path, it works now.

For now, I'm running two copies of the advforecast2.php file.  Once I flip my full page forecast over to use the new path, i should be able to easily flip the homepage and run one copy.

Thanks Ken.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI