Witam,

Pisze galerie zdjęć i chce właśnie coś takiego u siebie zrobić...jak jest w większości galeri.
Chodzi mi o to aby w każdym wierszu były 3 miniaturki zdjęć.
np.

nie tak:

  1. zdjęcie
  2.  
  3. zdjęcie
  4.  
  5. zdjęcie


tylko tak:

  1. zdjęcie zdjęcie zdjęcie
  2.  
  3. zdjęcie zdjęcie zdjęcie


Narazie zrobiłem taki skrypt:

php:

  1. <?php
  2.  
  3. $template->assign_body('gallery.tpl', 'ma');
  4.  
  5. $sql = "SELECT id, title, name, data FROM " . GALLERY_TABLE . " ORDER BY date";
  6. $result = mysql_query($sql);
  7.  
  8. while($gallery = mysql_fetch_array($result)) 
  9. {
  10. $image = getimagesize('images/test.gif');
  11. $y = $image[1];
  12. $x = $image[0];
  13.  
  14.  if($x > $y){
  15. $nx = 100;
  16. $ny = 100 * ($y / $x);
  17.  }elseif($x < $y){
  18. $nx = 100 * ($x / $y);
  19. $ny = 100;
  20.  }else{
  21. $nx = 100;
  22. $ny = 100;
  23.  }
  24.  
  25. $template->assign_loop_vars('gallery', array(
  26. 'NAME' => $gallery['name'],
  27. 'ID' => $gallery['id'],
  28. 'NX' => $nx,
  29. 'NY' => $ny,
  30. 'TITLE' => $gallery['title'],
  31. 'DATA' => $gallery['data'],
  32. ));
  33.  
  34. $how++;
  35. if($how == 3) 
  36. {
  37. $template->assign_loop_vars('gallery.br', array(
  38. 'BR' => '</tr><tr>'
  39. ));
  40. $how = 0;
  41. }
  42.  
  43. }
  44.  
  45. $template->display_body();
  46.  
  47.  
  48. ?>


i szablon
  1. <table align="center" width="100%" cellpadding="0" cellspacing="0" border="0">
  2. <tr>
  3. <!-- BEGIN gallery -->
  4. <td>
  5. <table align="center" width="100%" cellpadding="0" cellspacing="0" border="0">
  6. <tr>
  7. <td align="center"><img src="images/{gallery.NAME}" style="border: 2px #d0d0d0 solid" width="{gallery.NX}" height="{gallery.NY}"></td>
  8. </tr>
  9. <tr>
  10. <td align="center"><A href="#" onclick="java script:otworz('show.php?id={gallery.ID}');">Zobacz</a></td>
  11. </tr>
  12. <tr>
  13. <td align="center"><b>{gallery.TITLE}</b></td>
  14. </tr>
  15. <tr>
  16. <td align="center">Data: {gallery.DATA}</td>
  17. </td>
  18. </tr>
  19. </td>
  20. <!-- BEGIN br -->
  21. {gallery.br.BR}
  22. <!-- END br -->
  23. <!-- END gallery -->
  24. <td height="5">&nbsp;</td>
  25. </tr>


ale niestety to nie działa...:/