my product.xml :
<product>
<name></name>
<price></price>
<short_desc></short_desc>
<quantity></quantity>
</product>
how i can split xml data to many page, let's say i have 30 record of product and i want it to show 5 per page, so then i have 6 page in the same 1 file.php.
i was read to split to pages but it doesn't work, anyone can help me?
$objDOM = new DOMDocument();
$objDOM->load("product.xml");
$titleArray = array();
$ps = $objDOM->getElementsByTagName("product");
$allItems = array(
"name" => $node->getElementsByTagName("name")->item(0)->nodeValue,
"rice" => $node->getElementsByTagName("price")->item(0)->nodeValue,
"short_desc" => $node->getElementsByTagName("short_desc")->item(0)->nodeValue,
"quantity" => $node->getElementsByTagName("quantity")->item(0)->nodeValue);
$itemsPerPage = 5;
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
foreach (array_slice($allItems, $page * $itemsPerPage, $page * $itemsPerPage + $itemsPerPage) as $item) {
echo "$item\n";
}
this is what i have doing but it doesn't show anything,,