-------------cities.xml
Philadelphia
PA
1526000
5965000
Eagles
76ers
Phillies
Flyers
http://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Philadelphia_Panorama_From_Camden.JPG/640px-Philadelphia_Panorama_From_Camden.JPG
Pittsburgh
PA
306000
2356000
Steelers
Pirates
Penguins
http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Pittsburgh_dawn_city_pano.jpg/640px-Pittsburgh_dawn_city_pano.jpg
Cleveland
OH
397000
2077000
Browns
Cavaliers
Indians
http://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cleveland_Skyline_Aug_2006.JPG/799px-Cleveland_Skyline_Aug_2006.JPG
Columbus
OH
lots
even more
Bluejackets
home/mestick.gif
Indianapolis
IN
820000
1756000
Colts
Pacers
http://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Downtown_Indy_snow.jpg/320px-Downtown_Indy_snow.jpg
Baltimore
MD
621000
2710000
Ravens
Orioles
http://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Bmore-Skyline1.jpg/640px-Bmore-Skyline1.jpg
-------------citysample.php
Lots of nifty cities
children() as $city)
{
foreach ($city->NAME[0]->attributes() as $a => $b)
{
if ($a=="region" && $b=="east")
{
echo "\n";
foreach ($city->children() as $info)
{
echo $info->GetName() . ":" . $info . "
";
}
echo "
";
}
}
}
?>
children() as $city)
{
if ($city->STATE[0]=="PA")
{
echo "";
foreach ($city->children() as $info)
{
echo $info->GetName() . ":" . $info . "
";
}
echo "
";
}
}
?>
children() as $city)
{
if ($city->BASKETBALL[0]!="")
{
echo "";
foreach ($city->children() as $info)
{
echo $info->GetName() . ":" . $info . "
";
}
echo "
";
}
}
?>
-------------citychoose.html
Choose your parameters
-------------cityshow.php
Lots of nifty cities
";
echo "Try again";
}
else
{
foreach ($xml->children() as $city)
{
//see if the city has the sport
$printit = false;
foreach ($city->children() as $info)
{
if ($info->GetName() == $sport)
{ $printit = true; $teamname = $info;}
}
//print it if true and the state is right or unspecified
if ($printit && ($city->STATE[0]==$st || $st==""))
{
echo '' . $city->NAME[0] . " " . $teamname . "
";
echo "Metropolitan Area Population: " .
$city->POP[0]->METRO[0] . "
";
echo '
';
}
}
echo "Do another query.";
}
?>