1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<?
define('NB_PAR_PAGE', 10);
// On récupère le num de page sur laquelle on est pagination
$city="Strasbourg";
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$document = ('simplexml_load_file('http://zzz.clickline.co.uk/feed-distribution');
// Test 1
$count = count($document->xpath(utf8_encode("//products/product[destination=\"$city\"]")));
// Test 2
$count = count($document->xpath(utf8_encode("//products/product/lastUpdated/title/url/thumbnailUrl/currency[destination=\"$city\"][position()>=$debut_pos and position()<$fin_pos]"));
$debut_pos = ($page - 1) * NB_PAR_PAGE + 1;
$fin_pos = $page * NB_PAR_PAGE + 1;
$derniere_page = ceil($count / NB_PAR_PAGE);
$produits = $document->xpath(utf8_encode("//products/product/lastUpdated/title/url/thumbnailUrl/currency[destination=\"$city\"][position()>=$debut_pos and position()<$fin_pos]"));
print_r($produits);
?> |
Partager