Bonjour, j'ai quelque soucis je n'arrive pas à afficher une pagination de mon fichier xml comportant pres de 800 item.

J'arrive pour l'instant à afficher les 10 premiers, mais comment faire pour afficher les autres via un lien par exemple : page 1 , page 2 ect ...

voici mon code, la ou j'en suis pour l'instant.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
 
// le répertoire "cache" 
 
$dir_cache = 'cache/';
 
// nom du fichier mis en cache
$file_cache1 = 'flux1.html';
 
if (!is_dir($dir_cache)) {
exit ('Répertoire cache "'.$dir_cache.'" inexistant !');
}
 
 
// on impose la mise à jour avec une certaine periodicité
$date_modif1 = time();
// le delai entre deux rafraichissements en secondes 
$delai1 = 43200;
 
 
// le fichier est-il en cache et suffisamment jeune
$file_cache1 = $dir_cache.$file_cache1;
$en_cache1 = file_exists($file_cache1);
if ($en_cache1) {
$en_cache1 = ($date_modif1 < filemtime($file_cache1) + $delai1);
}
 
if (!$en_cache1) {
// Lecture d'un fichier XML
function lit_xml1($fichier,$item,$champs) 
{
// on lit le fichier
	if($chaine = @implode("",@file($fichier))) 
	{
		// on explode sur <item>
		$tmp = preg_split("/<\/?".$item.">/",$chaine);
 
 
		$nombre = sizeof($tmp);
		$items=40; // nombre d'items voulu
		$limite=$debut+1+$items;
 
		if($nombre<=$items)
		{
			$debut=0;
			$limite=$nombre;
		}
 
		// pour chaque <item>
		for($i=$debut+1;$i<$limite -1;$i+=2)         // on lit les champs demandés <champ>
			foreach($champs as $champ) 
			{
				$tmp2 = preg_split("/<\/?".$champ.">/",$tmp[$i]);    // on ajoute au tableau
				$tmp3[$i-1][] = @$tmp2[1];        
			}     
		// et on retourne le tableau
		return $tmp3;  
	}
}
 
// Exemple :
$xml1 = lit_xml1("rss/liste_site/liste_site_18.xml","item",array("num","id_site","title","url","description","ins","outs","new_url","country","click_out_lien",));
 
foreach($xml1 as $row1) { 
 
	$row1[2] = str_replace('<![CDATA[', '', $row1[2]);
	$row1[2] = str_replace(']]>', '', $row1[2]);
 
	$row1[3] = str_replace('<![CDATA[', '', $row1[3]);
	$row1[3] = str_replace(']]>', '', $row1[3]);
 
	$row1[4] = str_replace('<![CDATA[', '', $row1[4]);
	$row1[4] = str_replace(']]>', '', $row1[4]);
 
	$row1[7] = str_replace('<![CDATA[', '', $row1[7]);
	$row1[7] = str_replace(']]>', '', $row1[7]);
 
	$row1[8] = str_replace('<![CDATA[', '', $row1[8]);
	$row1[8] = str_replace(']]>', '', $row1[8]);
 
	$row1[9] = str_replace('<![CDATA[', '', $row1[9]);
	$row1[9] = str_replace(']]>', '', $row1[9]);
 
	$data1 .= '<table width="607" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
				<td width="15">&nbsp;</td>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">';
 
	$data1 .=	'<tr><td height="20" valign="top" class="texte_arial-13-gras-rouge"><a href="'.$row1[3].'" onmousedown="return out(\''.$row1[9].'\')" " target="_blank" class="lien_arial-13-gras-rouge_souligne">'.$row1[2].'</a></td>
				</tr>';
 
	$data1 .=	'<tr>
				<td><a href="'.$row1[3].'" onmousedown="return sponsor(\''.$row1[9].'\')" target="_blank" class="lien_arial-12-normal-noir_idem">'.$row1[4].'</a></td>
				</tr>
				<tr>
				<td class="texte_arial-12-normal-noir" height="15" valign="bottom"><a href="'.$row1[3].'" onmousedown="return sponsor(\''.$row1[9].'\')" target="_blank" class="lien_arial-10-normal-gris-clair_souligne">Fiche du site : '.$row1[2].'</a></td>
				</tr>
				</table>
				</td>
				<td width="77" align="center"><img src="images/flag-france.gif" width="19" height="13" alt="france"></td>
				<td width="77" align="center" class="texte_arial-11-normal-gris">'.$row1[5].'</td>
				<td width="77" align="center" class="texte_arial-11-normal-gris">'.$row1[6].'</td>
				</tr>
				</table>
				<table width="599" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
				<td background="images/ico_pointilles_sites.gif"><img src="images/spacer.gif" width="100%" height="13" alt="'.$alt_page.'"></td>
				</tr>
				</table>';
 
}
 
$fd1 = fopen($file_cache1, "w");
fputs($fd1, $data1);
fclose($fd1);
 
} // fin if !$en_cache1
 
include $file_cache1;
?>
merci de votre aide