Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> stronnicowanie
integer000
post 1.01.2007, 16:48:02
Post #1





Grupa: Zarejestrowani
Postów: 129
Pomógł: 0
Dołączył: 24.09.2005

Ostrzeżenie: (30%)
XX---


mam taki skrypt:

  1. <?php
  2. $dir = "katalog/";
  3.  
  4. if (is_dir($dir)) {
  5.  if ($dh = opendir($dir)) {
  6.  while (($file = readdir($dh)) !== false) {
  7. if (($file != '.')&&($file != '..')) {
  8. $files = $dir.$file;
  9. $total++;
  10.  
  11. echo $total;
  12. echo"<img src="$files">";  
  13.  
  14.  
  15. }
  16.  }
  17.  closedir($dh);
  18.  } 
  19. }
  20. ?>


skrypt ten wyświetla mi zdjęcia z katalogu wcześniej zadeklarowanego w zmiennej $dir.
Jak zmodyfikować ten skrypt tak aby stronnicował co 10 zdjęć na stronie questionmark.gif
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Cysiaczek
post 1.01.2007, 16:57:56
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Gotowców brak - problem często poruszany

1. http://forum.php.pl/index.php?showtopic=35...l=stronicowanie
2. http://forum.php.pl/index.php?showtopic=56...l=stronicowanie
3. http://forum.php.pl/index.php?showtopic=55...l=stronicowanie

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
kociupk
post 1.01.2007, 17:00:32
Post #3





Grupa: Zarejestrowani
Postów: 97
Pomógł: 1
Dołączył: 29.03.2006

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $ile_wszystkich = mysql_query("SELECT * FROM baza") or die(mysql_error());
  3. $count = mysql_num_rows($ile_wszystkich);
  4.  
  5. if(!$od) $od = 0;
  6. $do = 10;
  7. $zapytanie = mysql_query("SELECT * FROM baza LIMIT $od, $do") or die(mysql_error());
  8. while($wynik = mysql_fetch_array($zapytanie))
  9. {
  10. echo '<table border="0">
  11. <tr>
  12. <td>'
  13. .$wynik['dane].
  14. '</td>
  15. <td>'
  16. .$wynik['dane].
  17. '</td>
  18. </tr>
  19. </table>';
  20. }
  21.  
  22. if($od > 0)
  23. {
  24. echo '<a class="poprzednia_nastepna" href="'.$PHP_SELF.'?od='.($od-10).'">
  25. <img src="index_pliki/poprzedne.png" border="0" /></a> ';
  26. }
  27. for($i = 0; $i < ceil($count/$do); $i++)
  28. {
  29. echo '<a class="text_strony" href="'.$PHP_SELF.'?od='.($i*$do).'">'.($i+1).'</a> ';
  30. }
  31. if($od != ($i*$do-10))
  32. {
  33. echo '<a class="" href="'.$PHP_SELF.'?od='.($od+10).'">
  34. <img src="index_pliki/nastepne.png" border="0" />
  35. </a> ';
  36. }
  37. ?>
Go to the top of the page
+Quote Post
integer000
post 1.01.2007, 19:07:12
Post #4





Grupa: Zarejestrowani
Postów: 129
Pomógł: 0
Dołączył: 24.09.2005

Ostrzeżenie: (30%)
XX---


kociupk <== jak to się ma do mojego pytania questionmark.gif nie przeczytałeś pytania !
Go to the top of the page
+Quote Post
jekyl
post 1.01.2007, 19:30:18
Post #5





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 23.12.2006

Ostrzeżenie: (0%)
-----


sadze ze dobrze by bylo nadac jakies specyficzne nazwy obrazka np img_01.jpg itd nastepnie robic to co teraz tylko ograniczac to np do 10 zdjec a skad wiadomo ktore wyswietlac w poscie albo getem przeslij sobie numer strony
numer strony * 10 = max
numer strony * 9 = min

nazwe obrazka zrob explodem i wyswietl te ktore pasuja winksmiley.jpg
Go to the top of the page
+Quote Post

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 - 05:29