Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] wyświetlenie zawartości katalogu jako linku
-T1000-
post 8.12.2007, 20:40:40
Post #1





Goście







Witam staram się "napisać" skrypt wyświetlający zawartość katalogu jako link narazie doszedłem do tego
  1. <?php
  2. $directory="/inc/linux/";
  3. $dir=opendir($directory);
  4. while($file_name=readdir($dir))
  5. {
  6. if(($file_name!=".")&&($file_name!=".."))
  7. {
  8. $file_list.="<LI>$file_name";
  9. }
  10. }
  11.  
  12. closedir($dir);
  13.  
  14. "<a href=/"localhost/inc/linux/$file_list/"> $file_list </a>";
  15. ?>

Ale wywala mi błąd
  1. <?php
  2. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:AppServwwwinclinux.php on line18
  3. ?>

Będe wdzięczny za naprowadzenie mnie na rozwiązanie tego "problemu"
Pozdarwiam
Go to the top of the page
+Quote Post
dziurson
post 8.12.2007, 20:49:25
Post #2





Grupa: Zarejestrowani
Postów: 145
Pomógł: 16
Dołączył: 19.07.2007
Skąd: Elbląg

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


nie te ukośniki były

  1. <?php
  2. "<a href=\"localhost/inc/linux/$file_list\"> $file_list </a>";
  3. ?>


tu też namły błąd
  1. <?php
  2. $file_list.="<LI>".$file_name;
  3. ?>


Ten post edytował dziurson 8.12.2007, 20:55:09


--------------------
Go to the top of the page
+Quote Post
-T1000-
post 8.12.2007, 21:11:14
Post #3





Goście







Niemoge sobie poradzić z tym kawałkiem
  1. <?php
  2. $file_list.="<br>".$file_name;
  3. ?>

Całość plików które mam w folderze wyświetla mi jako jeden link nazwa1.jpg<br>nazwa2.jpg<br> itd
Go to the top of the page
+Quote Post
dziurson
post 8.12.2007, 21:14:20
Post #4





Grupa: Zarejestrowani
Postów: 145
Pomógł: 16
Dołączył: 19.07.2007
Skąd: Elbląg

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


w sumie nie wiem po co robisz sobie pod górkę:
najpierw zrób pętlę która zrobi tabelę z nazwami a później to wyświetl drugą pętlą smile.gif


--------------------
Go to the top of the page
+Quote Post
-T1000-
post 8.12.2007, 23:49:42
Post #5





Goście







  1. <?php
  2.  
  3. $katalog = dir('.'); // bieżący katalog
  4.  
  5. while($plik = $katalog->read()){
  6.  
  7. echo "- <a href=" .$plik. ">" .$plik. "</a><br>";
  8.  
  9. }
  10.  
  11. $katalog->close();
  12.  
  13. ?>
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: 19.07.2025 - 16:55