Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][function.include]: failed to open stream
cheschire_kotek
post 13.08.2009, 16:40:53
Post #1





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 27.06.2009

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


Witam,
probuję podpiąć do swojej strony www.glinaidrewno.pl galerię www.glinaidrewno.pl/galeria/index.php, w której będę trzymał różne zdjęcia. Podglądając tu i tam wysiedziałem taki index.php:
  1. <?php
  2. // $id=$HTTP_GET_VARS("id");
  3. if (!isset($id)) $id="galeria_1";
  4. ?>
  5. <html>
  6. <head>
  7. <title>Zdjecia Doroty i Tomka</title>
  8. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
  9. <script type="text/javascript" src="js/prototype.js"></script>
  10. <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
  11. <script type="text/javascript" src="js/lightbox.js"></script>
  12. <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
  13. <link rel="Stylesheet" type="text/css" href="styleg.css" />
  14. </head>
  15. <body>
  16. <div id="top">
  17. <div id="NAGLOWEK">
  18. <table>
  19. <tr height=5><td></td></tr>
  20. <tr>
  21. <td align=left onclick="location.href='index.php?id=galeria_1';">Sandbach wrzesien 2009</td>
  22. <td align=right onclick="location.href='index.php?id=galeria_2';">Spacer zimowy po Powislu</td>
  23. </table>
  24. </div>
  25. <div id="GALERIA">
  26. <?php
  27. include("public_html/galeria/$id.php");
  28. ?>
  29. </div>
  30. <div id="STOPKA">
  31. <p style="font-size:8px">BARCGB22</p>
  32. </div>
  33. </div>
  34. </body>
  35. </html>
  36. [/html]


Niestety po odpaleniu www.glinaidrewno.pl/galeria/index.php pojawia się się błąd:

Warning: include(public_html/galeria/galeria_1.php) [function.include]: failed to open stream: No such file or directory in /home/puhatek/public_html/galeria/index.php on line 27

Proszę o informację jak mogę usprawnić działanie includa? Pliki galeria_1.php i galeria_2.php mają w sobie tylko tabele ze zdjeciami w komórkach.
Z góry dziękuję,
Tomek
Go to the top of the page
+Quote Post
Ociu
post 13.08.2009, 16:46:50
Post #2





Grupa: Moderatorzy
Postów: 1 566
Pomógł: 37
Dołączył: 14.05.2003
Skąd: Kraków




Daj przed if'em:
  1. $id=$_GET["id"];
Go to the top of the page
+Quote Post
erix
post 13.08.2009, 16:48:28
Post #3





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Sobie lepiej sprawdź ścieżki. Na pewno cały skrypt masz poza public_html? Mi się widzi, że jednak w.


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
marian2299
post 13.08.2009, 16:52:27
Post #4





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


  1. #
  2. <?php
  3. #
  4. include("public_html/galeria/$id.php");
  5. #
  6. ?>

Zamień na
  1. #
  2. <?php
  3. #
  4. include("galeria/$id.php");
  5. #
  6. ?>


--------------------
film edit student
Go to the top of the page
+Quote Post
cheschire_kotek
post 13.08.2009, 17:11:17
Post #5





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 27.06.2009

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


index.php wygląda teraz tak:

  1. <?php
  2. // $id=$_GET["id"];
  3. if (!isset($id)) $id="galeria_1";
  4. ?>
  5. <html>
  6. <head>
  7. <title>Zdjecia Doroty i Tomka</title>
  8. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
  9. <script type="text/javascript" src="js/prototype.js"></script>
  10. <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
  11. <script type="text/javascript" src="js/lightbox.js"></script>
  12. <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
  13. <link rel="Stylesheet" type="text/css" href="styleg.css" />
  14. </head>
  15. <body>
  16. <div id="top">
  17. <div id="NAGLOWEK">
  18. <table>
  19. <tr height=5><td></td></tr>
  20. <tr>
  21. <td align=left onclick="location.href='index.php?id=galeria_1';">Sandbach wrzesien 2010</td>
  22. <td align=right onclick="location.href='index.php?id=galeria_2';">Spacer zimowy po Powislu</td>
  23. </table>
  24. </div>
  25. <div id="GALERIA">
  26. <?php
  27. include("galeria/$id.php");
  28. ?>
  29. </div>
  30. <div id="STOPKA">
  31. <p style="font-size:8px">BARCGB22</p>
  32. </div>
  33. </div>
  34. </body>
  35. </html>

komunikat wciąż ten sam

Warning: include(galeria/galeria_1.php) [function.include]: failed to open stream: No such file or directory in /home/puhatek/public_html/galeria/index.php on line 27
Warning: include() [function.include]: Failed opening 'galeria/galeria_1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/puhatek/public_html/galeria/index.php on line 27


Erix: cały skrypt mam w /public_html/galeria. W /public html są pliki strony glinaidrewno.pl
Go to the top of the page
+Quote Post
marian2299
post 13.08.2009, 17:32:11
Post #6





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


Kod powinien chyba wyglądać tak:
  1. <?php
  2. // $id=$_GET["id"];
  3. $id="galeria_1";
  4. if (!isset($id)) {
  5. ?>
  6. <html>
  7. <head>
  8. <title>Zdjecia Doroty i Tomka</title>
  9. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
  10. <script type="text/javascript" src="js/prototype.js"></script>
  11. <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
  12. <script type="text/javascript" src="js/lightbox.js"></script>
  13. <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
  14. <link rel="Stylesheet" type="text/css" href="styleg.css" />
  15. </head>
  16. <body>
  17. <div id="top">
  18. <div id="NAGLOWEK">
  19. <table>
  20. <tr height=5><td></td></tr>
  21. <tr>
  22. <td align="left" onclick="location.href='index.php?id=galeria_1';">Sandbach wrzesien 2010</td>
  23. <td align="right" onclick="location.href='index.php?id=galeria_2';">Spacer zimowy po Powislu</td>
  24. </table>
  25. </div>
  26. <div id="GALERIA">
  27. <?php
  28. include("'$id'.php");
  29. ?>
  30. </div>
  31. <div id="STOPKA">
  32. <p style="font-size:8px">BARCGB22</p>
  33. </div>
  34. </div>
  35. </body>
  36. </html>
  37. <?
  38. } ?>

Pewny nie jestem.


--------------------
film edit student
Go to the top of the page
+Quote Post
cheschire_kotek
post 13.08.2009, 18:52:55
Post #7





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 27.06.2009

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


Niestety z tym kodem też nie działa. Choć jest taka zmiana, że nie krzyczy nic o błędach. Strona jest po prostu pusta.

Udało mi się połowicznie. Zrobiłem tak index.php jest w katalogu /public_html/galeria natomiast galeria_1.php galeria_2.php w katalogu /public_html/galeria/inc. Kod teraz wygląda tak:

  1.  
  2. <?php
  3. // $id=$HTTP_GET_VARS("id");
  4. if (!isset($id)) $id="galeria_1";
  5. ?>
  6. <html>
  7. <head>
  8. <title>Zdjecia Doroty i Tomka</title>
  9. <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
  10. <script type="text/javascript" src="js/prototype.js"></script>
  11. <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
  12. <script type="text/javascript" src="js/lightbox.js"></script>
  13. <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
  14. <link rel="Stylesheet" type="text/css" href="styleg.css" />
  15. </head>
  16. <body>
  17. <div id="top">
  18. <div id="NAGLOWEK">
  19. <a href="?id=galeria_1">Sandbach wrzesien 2009</a> - <a href="?id=galeria_2">Spacer zimowy po Powislu</a>
  20. </div>
  21. <div id="GALERIA">
  22. <?php
  23. include("inc/$id.php");
  24. ?>
  25. </div>
  26. <div id="STOPKA">
  27. <p style="font-size:8px">BARCGB22</p>
  28. </div>
  29. </div>
  30. </body>
  31. </html>


Strona się ładuje, tyle że teraz galerie się nie przeładowują tongue.gif. Prosze o pomoc.

Ten post edytował cheschire_kotek 13.08.2009, 21:42:37
Go to the top of the page
+Quote Post
gcdreak
post 13.08.2009, 21:44:39
Post #8





Grupa: Zarejestrowani
Postów: 365
Pomógł: 8
Dołączył: 16.12.2008

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


To teraz wiadomo, że masz porawne ścieżki.
Teraz sprawdź dokładnie ten skrypt, który includowałeś.
Go to the top of the page
+Quote Post
cheschire_kotek
post 13.08.2009, 22:00:06
Post #9





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 27.06.2009

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


o ile dobrze rozumiem, to naciskając odnośnik definiuję id którego nazwa wskazuje w katalogu /inc plik, który ma być wczytany. Plik galeria_1.php wygląda tak
  1. <tr>
  2. <td><a href="P1030050.jpg" rel="lightbox[roadtrip]"><img src="P1030050m.jpg" alt="" /></a></td>
  3. <td><a href="P1030051.jpg" rel="lightbox[roadtrip]"><img src="P1030051m.jpg" alt="" /></a></td>
  4. <td><a href="P1030052.jpg" rel="lightbox[roadtrip]"><img src="P1030052m.jpg" alt="" /></a></td>
  5. <td><a href="P1030053.jpg" rel="lightbox[roadtrip]"><img src="P1030053m.jpg" alt="" /></a></td>
  6. </tr>
  7. <tr>
  8. <td><a href="P1030060.jpg" rel="lightbox[roadtrip]"><img src="P1030060m.jpg" alt="" /></a></td>
  9. <td><a href="P1030061.jpg" rel="lightbox[roadtrip]"><img src="P1030061m.jpg" alt="" /></a></td>
  10. <td><a href="P1030062.jpg" rel="lightbox[roadtrip]"><img src="P1030062m.jpg" alt="" /></a></td>
  11. <td><a href="P1030063.jpg" rel="lightbox[roadtrip]"><img src="P1030063m.jpg" alt="" /></a></td>
  12. </tr>


Gdzie popełniam błąd?

Ten post edytował cheschire_kotek 13.08.2009, 22:00:51
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: 16.06.2025 - 23:52