Jump to content

Quick Question for you guys


TFD3

Recommended Posts

Ok here is what im doing. Im trying to add a background image using php in css but im not sure if I have it set up right.

 

http://www.alabamastormtrackers.com/metar/conditions.php

See where it says (Sky: Heavy Rain)

I need a graphic to display IF Heavy Rain is present.

 

Trying to explain this best I can..

 

This is part of the CSS outside of the PHP script.

background: #cccccc url(<?php echo $image; ?>);

 

 

Here is the IF statement im not sure if I set up right.

 

if ($wxInfo['CONDITIONS'] == Heavy Rain) {

$image = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png";

}

 

 

 

Here is the whole script:

http://www.alabamastormtrackers.com/metar/script.txt

If you run the script your self to test you will also need this:

http://www.alabamastormtrackers.com/metar/conditions_metars.txt

 

Here is an EXAMPLE of what it should look like

http://www.alabamastormtrackers.com/metar/example.php

 

 

I have no idea what im missing?????

THANKS :)

Link to comment
https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/
Share on other sites

Well, either way you needed the quotes around the string...

 

You should check to see that you have error reporting turned on... when I ran the script I got a parse error where the quotes were missing.

 

error reporting is on i was just playing with the script.

I wonder if it could be because the entire output is not generated by php?

Ok i played around some more and maybe have found a different way...

At the bottom of the script I have added

 

 

if ($observed == "Overcast") {
$icon = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png";
}
echo "<img src=" . "$icon" . ">";
?>

 

Now the image does display but just in a different location. Is there a way to position the image at the top right portion of the box?

http://www.alabamastormtrackers.com/metar/conditions.php

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.