Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Dziwna kolejność w echo
-eth0-
post 19.10.2007, 14:18:34
Post #1





Goście







Witam.
Tworzę sobie prostą galerię php. Utworzyłem funkcje która pobiera różne detale (data, rozmiar, wymiary) z obrazka. Następnie funkcja ta jest zagnieżdżona w innej funkcji która generuje poszczególne miniaturki, wygląda to mniej więcej tak:

  1. <?php
  2. if (file_exists($duzyobraz)) {
  3. $rozmiar = round((filesize($duzyobraz)/1024),1);
  4. list($szer, $wys, $typ, $attr) = getimagesize($duzyobraz);
  5. $data = date("m-d-Y H:i:s", filemtime($duzyobraz));
  6. echo '
  7. <tr width="130px">
  8. <td class="detale">
  9. Nazwa:
  10. </td>
  11. <td class="detale">'
  12. .$duzyobraz.
  13. '</td>
  14. </tr>
  15. <tr width="130px">
  16. <td class="detale">
  17. Rozmiar:
  18. </td>
  19. <td class="detale">'
  20. .$rozmiar.
  21. '</td>
  22. </tr>
  23. <tr width="130px">
  24. <td class="detale">
  25. Data:
  26. </td>
  27. <td class="detale">'
  28. .$data.
  29. '</td>
  30. </tr>
  31. <tr>
  32. <td class="detale">
  33. Wymiary:
  34. </td>
  35. <td class="detale">'
  36. .$szer.' x '.$wys.'
  37. </td>
  38. </tr> ';
  39.  }
  40.  }
  41.  
  42. function displayPhotos(){
  43. global $columns;
  44.  
  45. generateThumbnails();
  46. $act = 0;
  47.  
  48. if ($handle = opendir(".")) {
  49.  
  50. while ($file = readdir($handle)) {
  51.  
  52. if (is_file($file)){
  53.  
  54. if (strpos($file,'_th.jpg')){
  55. ++$act;
  56. if ($act > $columns) {
  57. echo '<div><table>'.detale($file).'<tr><td class="photo" colspan=2><a href="'.getNormalImage($file).'">
  58.  <img src="'.$file.'" alt="'.$file.'" class="obrazek"/></a></td></tr></table></div>';
  59. $act = 1;
  60. } 
  61. else {
  62. echo '<div><table>'.detale($file).'<tr><td class="photo" colspan=2><a href="'.getNormalImage($file).'">
  63.  <img src="'.$file.'" alt="'.$file.'" class="obrazek"/></a></td></tr></table></div>';  
  64. }
  65.  
  66. }
  67.  
  68. }
  69. }
  70. } 
  71.  
  72. }
  73. ?>


Wynik tego wszystkiego wygląda tak:

  1. <div align="center" class="kontener">
  2.  
  3. <tr width="130px">
  4. <td class="detale">
  5. Nazwa:
  6. </td>
  7. <td class="detale">0_35.jpg</td>
  8. </tr>
  9. <tr width="130px">
  10. <td class="detale">
  11.  
  12. Rozmiar:
  13. </td>
  14. <td class="detale">21.5</td>
  15. </tr>
  16. <tr width="130px">
  17. <td class="detale">
  18. Data:
  19. </td>
  20. <td class="detale">10-14-2007 17:57:03</td>
  21.  
  22. </tr>
  23. <tr>
  24. <td class="detale">
  25. Wymiary:
  26. </td>
  27. <td class="detale">640 x 480
  28. </td>
  29. </tr> <div><table><tr><td class="photo" colspan=2><a href="0_35.jpg">
  30. <img src="0_35_th.jpg" alt="0_35_th.jpg" class="obrazek"/></a></td></tr></table></div>


Nie rozumie dlaczego wykonywana jest funkcja detale() a dopiero później reszta z echo (zaczynająca się od <div><tabl...). Proszę o pomoc w rozwiązaniu tego problemu.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 02:29