I’m using this code to display xml data in my php but it’s way too long so i want it to display the top ten results from it. How can i do it? Thank you.
<?
// DOMElement->getElementsByTagName() -- Gets elements by tagname
// nodeValue : The value of this node, depending on its type.
// Load XML File. You can use loadXML if you wish to load XML data from a string
$objDOM = new DOMDocument();
$objDOM->load("http://www.somesite.com/abc/some.xml"); //make sure path is correct
$note = $objDOM->getElementsByTagName("player");
// for each note tag, parse the document and get values for
// tasks and details tag.
foreach( $note as $value )
{
$tasks = $value->getElementsByTagName("place");
$task = $tasks->item(0)->nodeValue;
$details = $value->getElementsByTagName("nickname");
$detail = $details->item(0)->nodeValue;
$dups = $value->getElementsByTagName("Doubleuppoints");
$dup = $dups->item(0)->nodeValue;
$statuss = $value->getElementsByTagName("status");
$status = $statuss->item(0)->nodeValue;
echo "<table width='65%' border='0' cellpadding='3' cellspacing='1'><tr><td width='13%' class='Gradient' align='center' >$task </td><td width='32%' class='Gradient'> $detail</td><td width='34%' class='Gradient'> $dup</td><td width='20%' class='Gradient'> $status</td></tr></table> ";
}
?>