Here is the code:
Code: Select all
<?php
require_once("pxweather3.class.php");
$w = new Weather3();
$w->load();
foreach($w->getDaycasts() as $daycast)
{
?>
<span style="font-weight: bold";><span style="color:black;">
<?php
echo "" . $daycast['day']. "\n<br>";
?> </span></span>
<span style="color:black;">
<?php
echo $w->weatherString($daycast['weather']) . "\n<br>";
// Dynamic Weather Icons
// Clear (Day & Night)
if (($w->weatherString($daycast['weather']) == "Clear" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/sun.png' title='clear' alt='sunny' />\n<br>";
// Partly Cloudy (Day & Night)
elseif ( ($w->weatherString($daycast['weather']) == "Partly cloudy" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-pc.png' title='partly cloudy' alt='partly cloudy' />\n<br>";
// Mostly Cloudy (Day & Night)
elseif ( ($w->weatherString($daycast['weather']) == "Mostly cloudy" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-mc.png' title='mostly cloudy' alt='mostly cloudy' />\n<br>";
// Cloudy
elseif (($w->weatherString($daycast['weather']) == "Cloudy" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/c.png' title='cloudy' alt='cloudy' />\n<br>";
// Flurries
elseif ( ($w->weatherString($daycast['weather']) == "Flurries" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/flu.png' title='flurries' alt='flurries' />\n<br>";
// Fog
elseif ( ($w->weatherString($daycast['weather']) == "Fog" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/f.png' title='fog' alt='fog' />\n<br>";
// Haze
elseif ( ($w->weatherString($daycast['weather']) == "Haze" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-hz.png' title='hazy' alt='hazy' />\n<br>";
// Mostly Sunny
elseif ( ($w->weatherString($daycast['weather']) == "Mostly sunny" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-pc.png' title='mostly sunny' alt='mostly sunny' />\n<br>";
// Partly Sunny
elseif ( ($w->weatherString($daycast['weather']) == "Partly sunny" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-mc.png' title='partly sunny' alt='partly sunny' />\n<br>";
// Rain (Day & Night)
elseif ( ($w->weatherString($daycast['weather']) == "Rain" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-r.png' title='rain' alt='rain' />\n<br>";
// Sleet
elseif ( ($w->weatherString($daycast['weather']) == "Sleet" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/slt.png' title='sleet' alt='sleet' />\n<br>";
// Snow (Day & Night)
elseif ( ($w->weatherString($daycast['weather']) == "Snow" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-s.png' title='snow' alt='snow' />\n<br>";
// Sunny
elseif ( ($w->weatherString($daycast['weather']) == "Sunny" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/sun.png' title='sunny' alt='sunny' />\n<br>";
// Thunderstorms
elseif ( ($w->weatherString($daycast['weather']) == "Thunderstorms" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-tss.png' title='thunderstorms' alt='thunderstorms' />\n<br>";
// Thunderstorm (Day & Night)
elseif ( ($w->weatherString($daycast['weather']) == "Thunderstorm" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/d-ts.png' title='thunderstorm' alt='thunderstorm' />\n<br>";
// Unknown
elseif ( ($w->weatherString($daycast['weather']) == "Unknown" ))
echo "<img src='http://news7newslinc.net/wxgfx/new/na.png' title='unknown' alt='unknown' />\n<br>";
?>
</span>
<span style="color:red";>
<?php
if (isset($daycast['high_temp']))
echo "<b>Hi</b> " . $daycast['high_temp'] . "\n\n";
?>
</span>
<span style="color:black;">
|
</span>
<span style="color:blue";>
<?php
if (isset($daycast['low_temp']))
echo "<b>Lo</b> " . $daycast['low_temp'] . "\n<br>";
echo "\n<br>";
}
?>
</span>
It creates a big list. I would like to get each day into its own column in a table.
Thanks in advance for any help. I'm relatively new to PHP.