Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> sortowanie alfabetyczne
alchemic
post
Post #1





Grupa: Zarejestrowani
Postów: 63
Pomógł: 0
Dołączył: 8.01.2004
Skąd: Legnionowo

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


Witam

mam taki skrypt:

  1. <style type="text/css">
  2. <!--
  3. .style1 {
  4. font-size: 10px;
  5. font-family: Verdana, Arial, Helvetica, sans-serif;
  6. }
  7. -->
  8. </style>
  9. <br /><br />
  10. <? 
  11. $kto= "galeria"; 
  12. if ($handle = opendir($kto)) 
  13. { 
  14.  while (false !== ($file = readdir($handle))) 
  15.  { 
  16. if ($file != "." && $file != "..") 
  17. { 
  18. if($handle2 = opendir($kto.'/'.$file)) 
  19. {
  20.  while (false !== ($file = readdir($handle))) 
  21.  { 
  22. if ($file != "." && $file != "..") 
  23. { 
  24.  $f = fopen($kto.'/'.$file.'/nazwa.txt', 'r'); 
  25.  $tekst = fread($f, 255); 
  26.  echo "<table width="90%" border="0" align="center" cellpadding="2" cellspacing="1" bordercolor="#6284b7">"; 
  27.  echo" <tr> <td width=10%" align="center" bgcolor="#6284b7"><img src="grafika/p.gif" width="5" height="5" /></td>";
  28.  echo"<td width="90%" bgcolor="#6284b7"><span class="tekst"> <a href="index.php?strona=gal&kat=galeria/$file"><p align="left"><font face="Verdana" color="white" size="1">$tekst</a></span></td></tr></table>";
  29.  fclose($f); 
  30.  } 
  31.  } 
  32.  closedir($handle); 
  33. ?>


ale ma jeden blad wyswietla mi katalogi od 2 tz jak mam jeden w glaeri to nic nie wyswietla jak sa 2 to jeden tak...

a drugie pytanie to jak wyswietlic liste tych katalogow tak by nazwy $tekst byly wyswietlone alfabetycznie ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Pigula
post
Post #2





Grupa: Zarejestrowani
Postów: 446
Pomógł: 0
Dołączył: 5.03.2005
Skąd: Lublin

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


  1. <?php
  2. $i=0;
  3. while (false !== ($file = readdir($handle))) 
  4.  { 
  5. if ($file != "." && $file != "..") 
  6. { 
  7.  $f = fopen($kto.'/'.$file.'/nazwa.txt', 'r'); 
  8.  $tekst[$i]= fread($f, 255); //zapis nazwy do tablicy
  9.  fclose($f); 
  10. }
  11. $i++; 
  12.  }
  13. ?>

potem uzyj sort
a potem wyswietlanie w petli while
Cytat
i dlatego Ty jestes programista a ja fotografem smile.gif wybacz ale przerasta mnie to... smile.gif

i to jest najwiekszy problem Polakow robia to do czego nie sa stworzeni np. ja mam elektronike na studiach co do programowania nei jest mi zupelnie potrzebne
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 4.10.2025 - 16:29