Hi guys,
I'm fairly new to PHP so I'm hoping can help with an issue I am having. I am parsing three entries from an XML file. In total there are 101 entries in the XML file. I don't want to display the first entry in the XML file. I want to display entries 2 to 101 and not 1 to 100.
I'm not sure how I could do this so I am hopping for some assistance. My code is:
<?
$objDOM = new DOMDocument();
$objDOM->load("RunDapp.xml");
$entry = $objDOM->getElementsByTagName("entry");
foreach( $entry as $value )
{
$previouspos = $value->getElementsByTagName("previouspos");
$ppos = $previouspos->item(0)->nodeValue;
$currentpos = $value->getElementsByTagName("currentpos");
$cpos = $currentpos->item(0)->nodeValue;
$albumname = $value->getElementsByTagName("albumname");
$album = $albumname->item(0)->nodeValue;
$artistname = $value->getElementsByTagName("artistname");
$artist = $artistname->item(0)->nodeValue;
?>
<ul>
<li><?php echo "$ppos"; ?> - <strong><?php echo "$cpos"; ?></strong> - <?php echo "$album"; ?> - <?php echo "$artist"; ?></li>
</ul>
<?php } ?>
I am looking at array slicing but tbh I'm a bit lost. Any pointers are much appreciated.