bonjour à tous,
je veux faire une pagination de ma galerie photo.
j'ai créé un tableau qui affiche toutes les photos correspondant à ma requete sql. j'ai fait un bout de code qui me compte le nombre de photo à afficher et m'affiche les pages pour cette catégorie ex pages :1 2 3.
mais mon soucis c'est que je n'arrive pas à faire des liens pour afficher par exemple la page 2 de mon tableau. est ce que quelqu'un serait faire.
voici mon code :
Code php : 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 ///pagination $catid=$_GET["catid"]; echo "<div class='sectiontableentry15'><table><tr>"; echo '<td width="";>'; $min=1; $max=18; $pre=mysql_query(" SELECT count( `id` ) FROM `jos_datsogallery` WHERE `catid` =".$catid." and `published` ='1' "); $tot=mysql_result($pre,0,0); //echo $total; $nombre=$tot/18; //echo $nombre; echo "Pages : "; for($i=1;$i<$nombre+1;$i++) { if(($min<=$total)&&($total<=$max)) { echo $i=$nombre.' '; } else { echo $i.' '; $min=$min+$max; $max=$max+18; } } echo '</td></tr>'; // tableau de miniatures $catid=$_GET["catid"]; $id_photo=$_GET["id"]; $query="SELECT * FROM `jos_datsogallery` WHERE `published` ='1' AND `catid` =".$catid." ORDER BY `ordering` limit 0,18"; $result=mysql_query($query); $i=0; $max=3; while($val=mysql_fetch_array($result)) { $nom=$val['imgthumbname']; $titre=$val['imgtitle']; $num=$val['id']; if($i>0 && $i%3==0) { echo '</tr><tr>'; } echo '<td>'; echo "<a href=\"index.php?option=com_datsogallery&Itemid=27&func=detail&catid=".$catid."&id=".$num."\"><img src=components/com_datsogallery/img_thumbnails/$nom alt=$nom title=$titre border='0'/></a>"; echo '</td>'; $i++; } echo '</tr>'; echo'</table></div>';
merci d'avance pour votre aide.
Partager