Code: Select all
<html>
<head>
<title>Testing Area: In Emergency Contact - <?php echo $_SERVER["SERVER_ADMIN"]; ?></title>
<link rel="StyleSheet" href="style/style.css" type="text/css">
</head>
<body>
<?php
$mapPoints = array
(
array
(
"x" => 10,
"y" => 10,
"LocationType" => "Water Planet",
"Empire" => "Neen Jah Sqwerls"
),
array
(
"x" => 5,
"y" => -5,
"LocationType" => "Ice Planet",
"Empire" => "Neen Jah Sqwerls"
),
array
(
"x" => -10,
"y" => 6,
"LocationType" => "Ice Planet",
"Empire" => "Neen Jah Sqwerls"
)
);
function CheckMapPoints($xPoint, $yPoint)
{
global $mapPoints;
foreach($mapPoints as $Location)
{
if($Location["x"] == $xPoint && $Location["y"] == $yPoint)
{
$OwnedBy = $Location["Empire"];
switch($Location["LocationType"])
{
case "Ice Planet": $ImageType = "IcePlanet.gif"; break;
case "Water Planet": $ImageType = "WaterPlanet.gif"; break;
case "Desert Planet": $ImageType = "DesertPlanet.gif"; break;
case "Temperate Planet": $ImageType = "TemperatePlanet.gif"; break;
case "Jungle Planet": $ImageType = "JunglePlanet.gif"; break;
case "Satellite": $ImageType = "Satellite.gif"; break;
}
}
else
{
$ImageType = RandomDeepSpace();
$OwnedBy = "Deep Space";
}
}
$mapHTML = "<img src="images/$ImageType" alt="$OwnedBy:$xPoint,$yPoint">";
Return $mapHTML;
}
function RandomDeepSpace()
{
$Image = "DeepSpace_1.gif";
Return $Image;
}
function GenerateMap($xRange, $yRange)
{
// The first thing we need to do is set $y to the $yStart
// This way when we start to create our Map it will start
// at the correct y Starting point
$y = (($yRange / 2) - $yRange);
// The neyt thing we do is begin to count.
// If the Mapper wants to make a map from y.-100 to y.+100
// Then this little WHILE statement will make that happen...
while($y != ($yRange / 2) + 1)
{
// Since we are counting ONCE through the Y Range
// And we are counting Y Times through the X Range
// We want to start the X Counter over everytime we go
// through the Y Range
$x = (($xRange / 2) - $xRange);
// In order to start a Y Range, we begin a TR or Table Row
echo("\t<tr> \n");
// Now that we have a TR started, we begin to count
while($x != ($xRange / 2) + 1)
{
echo("<td>".CheckMapPoints($x, $y)."</td> \n");
$x++;
}
echo("\t</tr> \n");
$y++;
}
}
?>
<div class="wfMap">
<table>
<?php GenerateMap(100, 100); ?>
</table>
</div>
</body>
</html>Instead it ONLY shows the last one in the mapPoints array?
Where am I screwing up...?