Author Topic: Newbie Question!!! Please help!  (Read 5792 times)

0 Members and 1 Guest are viewing this topic.

Offline TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Newbie Question!!! Please help!
« on: May 29, 2007, 08:23:20 PM »
Ok, as I stated in the subject, I am a newbie at making websites! My site is http://www.tricountyweather.com .    I am wanting to put a local forecast on the website, and I have seen many people basically use the NWS forecast on their site. How can I do this! Basically, so far I have just been using Expression Web to make the site and would do anything to get a forecast on it!   I need it for Wichita Falls, Tx.     Thankyou!!!

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Newbie Question!!! Please help!
« Reply #1 on: May 29, 2007, 08:35:07 PM »
Hi, and welcome to WXForum!

The forecast with icons from the NWS is a PHP script, originally developed by carterlake.  I've added some stuff to Tom's PHP script, so you can get it from http://saratoga-weather.org/scripts-carterlake.php#carterlake

You'll need to have PHP on your webserver (most hosters offer it), but it's good to test that ( http://saratoga-weather.org/scripts.php#PHPTest ) before starting installation of other PHP scripts you might want to use.

Best regards,
Ken
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 TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #2 on: May 29, 2007, 09:25:54 PM »
ok, I have PHP on my server, and I have been playing with the script for a while now and I still can not figure this out! Like I said, I am new to this whole thing. Does it matter that my homepage is .html and I am trying to place this on the homepage? My cell number is ********** and if you are really bored, feel free to shoot me a call. I am really lost as of now. I am pretty smart when it comes to websites, but totally new to PHP... Scott

Offline Anole

  • Forecaster
  • *****
  • Posts: 585
    • http://pineislandweather.com
Re: Newbie Question!!! Please help!
« Reply #3 on: May 29, 2007, 09:44:04 PM »
Quote from: "TriCountyWeather"
Does it matter that my homepage is .html and I am trying to place this on the homepage?


Yes. For most server configurations you will need to use the extension ".php" for your files in order for the server to process the php code in the file. While it is possible to set up most http servers to process php in a file with an ".html" extension, it's not done very often.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Newbie Question!!! Please help!
« Reply #4 on: May 29, 2007, 09:44:51 PM »
The easiest (and full function) way to call a PHP script by another page is to have the calling page be named with a .php extension -- it signals the webserver that the PHP intrepeter is to be run.  If the calling page is .php type, then
Code: [Select]
<?php $doIncludeNWS true; include&#40;"advforecast2.php"&#41;; ?> will put the forecast on the calling page.

If you want to keep your pages with .htm or .html, then you MAY be able to use Server-Side Includes (SSI) to bring the contents into the calling page.  This usually works only if the pages have types of .shtm or .shtml, but some hosters do SSI parsing on .htm and .html pages too.  You can give it a try using
Code: [Select]
<!--#include virtual="/advforecast2.php?inc=Y" --> where you'd like the forecast to appear on the calling page.  It may not work for your hoster.

In any case, changing the calling page to be .php extension is the best way to invoke any PHP script.

Hope this helps..
Best regards,
Ken
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 TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #5 on: May 29, 2007, 10:03:32 PM »
OK, here goes the really lazy route!!! If I put a link on the page that takes you to the forecast, would this be easier or even better? PHP scares me, why, I dunno! Guess just because I'm new at it.

Here's even a lazier idea... Anyone willing to make a few extra bucks wanna do it for me! lol    I am willing to pay to get this online, but I'm afraid that I might not have the best of knowledge to figure it out!

Offline TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #6 on: May 29, 2007, 10:29:31 PM »
OK, So here's what I have now! I converted the page to PHP, and I placed the script and it's now on the page. I placed a forecast.txt on the server and it seems to be showing fine.  Now here comes the dumb question, "Do I need to update the forecast.txt file daily to keep this working? I know that's probably a dumb question, but again, I'm clueless. Tricountyweather.com is the site.. So check it out and see if I need to change some stuff up... scott

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Newbie Question!!! Please help!
« Reply #7 on: May 29, 2007, 10:42:16 PM »
Congratulations!  You've done your first PHP program (adding PHP to a page) :-)   See... that wasn't so hard afterall.  You can kinda ease into using PHP by just doing what you did, so it shouldn't be a scary proposition.  Besides, we're here to help 'cause we've been through it too.

You don't have to update the forecast.txt file -- the advforecast2.php script does that (when required) for you, about every 10 minutes.  When the page is invoked, it checks to see if the cache file (forecast.txt) is older than 10 minutes, and if it is, it fetches a new forecast from the NWS server and stores the page for later processing.  That just eases the load on the NWS server a bit and makes your page appear faster for the majority of the viewers.

Best regards,
Ken
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 saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Newbie Question!!! Please help!
« Reply #8 on: May 29, 2007, 10:52:36 PM »
Now just a bit more customization, and your forecast page will be perfect.

You need to change two lines in the advforecast2.php script for your NOAA zone and point-printable forecast URL.  I'm assuming you are in Wichita Falls, TX (as it says on your Weather Display page).  First find
Code: [Select]
$NOAAZone = 'ALZ064';  // change this line to your NOAA warning zone. and change it to
Code: [Select]
$NOAAZone = 'TXZ086';  // change this line to your NOAA warning zone. then change the line that says:
Code: [Select]
$fileName = "http://www.srh.noaa.gov/forecast/MapClick.php?CityName=Gulf+Shores&state=AL&site=MOB&TextType=2";
to
Code: [Select]
$fileName = "http://www.srh.noaa.gov/forecast/MapClick.php?CityName=Wichita+Falls&state=TX&site=OUN&TextType=2";


Then save the file and upload your changed copy of advforecast2.php to your website.   Then run it using ?force=1 on the URL and it will reload the cache file with your forecast.   Then you're all set.

Best regards,
Ken
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 TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #9 on: May 29, 2007, 10:53:04 PM »
Thanks Again! Now I just ran into another problem... Everything works fine, but when I click on the link that states "Forecast from NOAA-NWS for Wichita Falls, TX. " It takes me to Gulf Shores, AL

Offline TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #10 on: May 29, 2007, 10:54:34 PM »
disregard that! I'm an idiot! I figured it out!

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9297
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Newbie Question!!! Please help!
« Reply #11 on: May 29, 2007, 11:04:15 PM »
Not an idiot.. just new to PHP.

I see it working now on your homepage http://www.tricountyweather.com/ -- makes me glad that I live in mild-climate California.  You've got chance of TStorms for each day!

Best regards,
Ken
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 TriCountyWeather

  • Member
  • *
  • Posts: 22
    • http://Tricountyweather.com
Re: Newbie Question!!! Please help!
« Reply #12 on: May 29, 2007, 11:20:32 PM »
No kidding! It's been raining almost everyday!!! We need it though, our lakes are so low. Kind of a bummer for Memorial Day though, but we will take all we can get! BTW, if you have any suggestions on the site, fell free to let me know. Thanks again! Scott