php > html help!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deft
Forum Newbie
Posts: 2
Joined: Fri May 02, 2003 4:59 am

php > html help!!!

Post by deft »

I'm building a site for my dad's fishing club and I'm trying to use a script which will let me put weather information on the site.

I am using a weather script from http://www.ravis.org/code/weather/index.html but I'm having difficulty with step 3...

The script retrieves information from weather.com... So far I have managed to get the script to retrieve the weather information and display the results at http://www.stgeorgeanglers.com/weather/index.php

I would now like to display the results in a html page so that the fisho's can see the weather forecast.

I tried to setup a test page at http://www.stgeorgeanglers.com/include.htm to somehow get this information into a html page but this isn't working. (See the source code for my dumbass effort

How do I get this information into a html page?

How do I display one of the results in a table/cell?

Step 3 isn't for newbie's like me as this is my first php effort. If anyone could offer any advice or point me in the right direction I would be extremely grateful :lol:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Basically, unless you can get the server to recognise .htm files as PHP (which is possible but may be overkill for one script) then you'll most likely have to have a .php extension on any page that tries to include PHP content.

That's why index.php works but include.htm doesn't (if you look in the source code of each you'll notice that the PHP isn't getting executed in the second).

Mac
deft
Forum Newbie
Posts: 2
Joined: Fri May 02, 2003 4:59 am

Post by deft »

O.K no problem... The page that I want the weather on is index.htm so I've now changed this to index.php and it has fixed the problem thanks mac :!:

I'm still having trouble with step 3 at http://www.ravis.org/code/weather/index.html

... i've put the code

<? $currentTemperature = $weatherData->getTemp(0,"c"); ?>

into the script like the instructions on ravis.org say, and when i run the script on the server I get the message 'Fatal error: Call to a member function on a non-object in /home/stgeorge/public_html/weather/index.php on line 25'

you can see my page with errors at

http://www.stgeorgeanglers.com/weather/index.php

I've tried editing the code in a number of ways and I can't seem to get it right. My code at the moment looks like this

include("Weather.php"); - the weather script
$Weather = New Weather("ASXX0112"); - the retrieve call to weather.com
$weather->getTemp("c"); - my bodgy effort to get a temp reading

I have no idea if i'm on the right track here, can anyone offer any advice to get the temp function to work?

Thanks for any advice :lol:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try this one

Code: Select all

<?php
$i = 0;
echo '$i ', (isset($i)) ? 'set' : 'undefined', "<br />\n";
echo '$I ', (isset($I)) ? 'set' : 'undefined';
?>
;)
Post Reply