Code: Select all
function playeronlinelist($url)
{
if ($xml = simplexml_load_file($url)) {
$playerstats = objectsIntoArray($xml);
if( $playersonlinecount = count($playerstats["playersOnline"]) > 1 ) {
foreach ($playerstats["playerStats"] as $player) {
echo "<tr>";
echo "<td>";
echo $player["playerName"];
echo "</td>";
echo "<td>";
echo $player["blocksPlaced"];
echo "</td>";
echo "<td>";
echo $player["blocksDestroyed"];
echo "</td>";
echo "<td>";
echo $player["itemsDropped"];
echo "</td>";
echo "<td>";
echo $player["metersTraveled"];
echo "</td>";
echo "<td>";
echo $player["totalPlaytime"];
echo "</td>";
echo "</tr>";
}
} else {
echo "ingen online";
}
} else {
echo "klarte ikke å loade stats";
}
}anyone got a simple solution to this? ive tried searching around a ton and it seems like fair deal of mind stretching
i also tried this
Code: Select all
foreach ($playerstats["playerStats"] as $player) {Code: Select all
foreach ($playerstats["playerStats"] as $player == $player["isOnline"] == "True") {here is a bit of the xml i turned into a array
Code: Select all
array(2) {
["playerStats"]=>
array(56) {
[0]=>
array(8) {
["blocksDestroyed"]=>
string(2) "11"
["blocksPlaced"]=>
string(3) "961"
["isOnline"]=>
string(4) "true"
["itemsDropped"]=>
string(2) "23"
["metersTraveled"]=>
string(5) "22825"
["playerName"]=>
string(9) "silentspy"
["playerSince"]=>
string(29) "2010-11-19T23:58:58.406+01:00"
["totalPlaytime"]=>
string(11) "14.95 hours"
}