i have a xml doc which i'm parsing with php and trying to split into different pages. i can't seem to pass the results of the array further than page 1, all it show is m result for page 1 over an over but for the correct amont of results
the example i followed didn't use sessions and i haven't changed the pagintion.class.php
does anone know where i'm going wrong, mus be in the array somewhere
Code: Select all
<?php
// Include the pagination class
include 'pagination.class.php';
// Create the pagination object
$pagination = new pagination;
// some example data
// set xpath search
$prop = $xml->xpath('/root/property[province="Alicante"]');
// initiate the search and display list
foreach ( $prop as $list) {
$propertyid = $list->id ;
$date = $list->date;
$ref = $list->ref;
$price = $list->price;
$pricefreq = $list->price_freq;
$type = $list->type->en;
$town = $list->town;
$provinceName = $list->province;
$location = $list->location_detail;
$beds = $list->beds;
$baths = $list->baths;
$pool = $list->pool;
$description = $list->desc->en->asXML();
$images = $list->images->image;
// search and set the primary image counter for use
$count = 0;
while ($list->images->image[$count]->primary != 1)
{
$count++;
}
// setup image thumb
$image = substr($list->images->image[$count]->url, 0, -9);
$properties[$cur_prop] = array (
'propertyid' => $propertyid,
'date' => $date,
'ref' => $ref,
'price' => $price,
'pricefreq' => $price_freq,
'type' => $type,
'town' => $town,
'provinceName' => $province,
'location' => $location_detail,
'beds' => $beds,
'baths' => $baths,
'pool' => $pool,
'description' => $description,
'image' => $image,
);
$cur_prop++;
}
//foreach ($properties as $key=> $value)
//{
// echo $key."-".$value."";
//}
// If we have an array with items
if (count($properties)) {
// Parse through the pagination class
$propertiesPages = $pagination->generate($properties, 6);
// If we have items
if (count($propertiesPages) != 0) {
// Create the page numbers
echo $pageNumbers = '<div class="numbers">'.$pagination->links().'</div>';
// Loop through all the items in the array
$current = 1;
foreach ($propertiesPages as $propertiesArray) {
// Show the information about the item
echo "<div class=\"property-box\"> \n";
echo "<h3>price: " . $properties[$current]['beds'] . "
bedroom " .$properties[$current]['type'] ." based in " . $properties[$currrent]['town'] ."</h3>\n";
$image_thumb = $properties[$current]['image'];
echo "<img src=\" " . $image_thumb . "med.jpg\" class=\"property-image\" alt=\"\" />\n" ;
echo "<h4>€" . $properties[$current]['price'] . "</h4>\n";
// remove chars from description
$description = substr($properties[$current]['description'], 0, 310);
echo "<p> " . nl2br($description) . " ......</p>\n" ;
echo "</div> \n";
$current++;
//echo '<p><b>'.$properties['propertyid'].'</b> £'.$properties['price'].'</p>';
}
// print out the page numbers beneath the results
echo $pageNumbers;
}
}
?>