Read and display XML add next / previous buttons

Discussion in 'XML & RSS' started by getwiththeprogram, Apr 11, 2009.

  1. #1
    Hi,
    I have started using the below code to read and loop through the XML file and then display fields which works fine. I can make it display 10 products pager page etc but is there a way of linking this to a next/previous buttons so page 2 would show 11-20 etc without having to hard code all pages?

    <?PHP
    $xmlobj = simplexml_load_file("file.xml");
    $num = count($xmlobj->product);
    $i = 0;
    for($i=0; $i<$num; $i++ )
    {
    $name = $xmlobj->product[$i]->name;
    $description = $xmlobj->product[$i]->description;
    $productUrl = $xmlobj->product[$i]->productUrl;
    $imageUrl = $xmlobj->product[$i]->imageUrl;
    $price = $xmlobj->product[$i]->price;
    ?>
     
    getwiththeprogram, Apr 11, 2009 IP