Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] tabela zależna od istnienia pliku pomocy gdzi
Piotrwusek
post 16.06.2007, 19:14:49
Post #1





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


chcę żeby tabela była zależna od pliku i nie zrobiłem skrypt ale nie działa nie wiem co zrobić

proszę o pomoc i o odpowiedż


  1. <?php
  2. /*
  3.  
  4. Copyright Š 2007 Piotrwusek
  5.  
  6. Released under the GNU General Public License
  7. */
  8.  
  9.  
  10. function url_exists($url) {
  11. $x = fopen($url, "r");
  12. if($x == False) {
  13. return False;
  14. } else {
  15. return True;
  16. }
  17. }
  18.  
  19.  
  20.  
  21.  
  22. include("includes/language/polish.php");
  23. ?>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  25. <html>
  26. <head>
  27. <meta name="verify-v1" content="<?php echo GOOGLE; ?>" />
  28. <link rel="SHORTCUT ICON" href="<?php echo IKONA; ?>">
  29. <meta http-equiv="content-type" content="<?php echo KODOWANIE; ?>" />
  30. <meta name="author" content="<?php echo AUTOR; ?>" />
  31. <meta name="description" content="Strona klasy 3a gimnazjum" />
  32. <meta name="keywords" content="<?php echo KEYWORDS; ?>" />
  33. <meta name="copyright" content="<?php echo PRAWA; ?>" />
  34. <meta http-equiv="content-language" content="pl" />
  35. <meta name="distribution" content="GLOBAL" />
  36. <link rel="stylesheet" href="stylesheet.css" type="text/css" />
  37. <title><?php echo TITLE; ?></title>
  38. </head>
  39. <body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" background="images/strona/tlo.bmp">
  40. <table border="0" width="908" height="" align="CENTER" valign="TOP" cellspacing="0" cellpadding="0" bgcolor="white">
  41. <tr>
  42. <td background="images/strona/tabela-prawo.bmp" width="11"></td>
  43. <td><?php require("includes/header.php"); ?>
  44. <table border="0" align="CENTER" valign="TOP" cellspacing="0" cellpadding="0" leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0">
  45. <tr>
  46. <?
  47. $a = url_exists("http://www.zsp3a.za.pl/includes/kolumna-lewa.php");
  48.  
  49. if($a == False) {
  50. echo("<td width="3"></td>
  51. <td width="201"><?php require("includes/kolumna-lewa.php"); ?></td>
  52. <td width="700"></td>
  53. <td width="3"></td>");
  54. } else {
  55. echo("<td width="3"></td>
  56. <td width="201"><?php require("includes/kolumna-lewa.php"); ?></td>
  57. <td width="500"></td>
  58. <td width="201"></td>
  59. <td width="3"></td>");
  60. }
  61. ?>
  62. </tr>
  63. </table>
  64.  
  65. <?php require("includes/stopka.php"); ?></td>
  66.  
  67. <td background="images/strona/tabela-lewo.bmp" width="11"></td>
  68. </tr>
  69. <tr background="images/strona/tabela-dol_1.bmp" height="10" widht="201"></tr>
  70. <td ></td>
  71. <td></td>
  72. </table>
  73. <br />
  74. </body>
  75. </html>
Go to the top of the page
+Quote Post
JaRoPHP
post 16.06.2007, 19:24:49
Post #2





Grupa: Zarejestrowani
Postów: 675
Pomógł: 15
Dołączył: 7.11.2004
Skąd: Katowice

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


Cytat
chcę żeby tabela była zależna od pliku i nie zrobiłem skrypt ale nie działa nie wiem co zrobić

Zrobiłeś skrypt, czy nie? smile.gif
Czym objawia się nie działanie?


--------------------
Kto pyta, nie błądzi...
Kto zbłądził, ten pyta...
Go to the top of the page
+Quote Post
Piotrwusek
post 16.06.2007, 19:46:18
Post #3





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


zrobiłem skrypt

strona jest czysta nic na niej nie ma

pierwsza cześć skryptu
  1. <?php
  2. function url_exists($url) {
  3. $x = fopen($url, "r");
  4. if($x == False) {
  5. return False;
  6. } else {
  7. return True;
  8. }
  9. }
  10. ?>


druga
  1. <?
  2. $a = url_exists("http://www.zsp3a.za.pl/includes/kolumna-lewa.php");
  3.  
  4. if($a == False) {
  5. echo("<td width="3"></td>
  6. <td width="201"><?php require("includes/kolumna-lewa.php"); ?></td>
  7. <td width="700"></td>
  8. <td width="3"></td>");
  9. } else {
  10. echo("<td width="3"></td>
  11. <td width="201"><?php require("includes/kolumna-lewa.php"); ?></td>
  12. <td width="500"></td>
  13. <td width="201"></td>
  14. <td width="3"></td>");
  15. }
  16. ?>

a 1 post wyżej cała strona

można efekty skryptu również zobaczyć na zsp3a.za.pl

Ten post edytował Piotrwusek 22.06.2007, 20:46:24
Go to the top of the page
+Quote Post
JaRoPHP
post 16.06.2007, 19:48:56
Post #4





Grupa: Zarejestrowani
Postów: 675
Pomógł: 15
Dołączył: 7.11.2004
Skąd: Katowice

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


na sam początek daj:
  1. <?php
  2. ini_set('error_reporting', E_ALL | E_STRICT);
  3. ini_set('display_errors', 'On');
  4. ?>

I powiedz, jaki jest rezultat.


--------------------
Kto pyta, nie błądzi...
Kto zbłądził, ten pyta...
Go to the top of the page
+Quote Post
fiszol
post 16.06.2007, 19:53:18
Post #5





Grupa: Zarejestrowani
Postów: 452
Pomógł: 16
Dołączył: 25.05.2004
Skąd: Gorzów Wlkp.

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


Raczej nic nie wyświetli bo nadpisze error_reporting tym co ma w 3 linii aktualnie


--------------------
\o/
Go to the top of the page
+Quote Post
Piotrwusek
post 16.06.2007, 19:54:36
Post #6





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


Cytat(JaRoPHP @ 16.06.2007, 20:48:56 ) *
na sam początek daj:
  1. <?php
  2. ini_set('error_reporting', E_ALL | E_STRICT);
  3. ini_set('display_errors', 'On');
  4. ?>

I powiedz, jaki jest rezultat.


nic sie nie stało jest cały czas czysta strona może to coś miec związek z inclde (wstawianiem zawartości pliku są w tym pliku definicje stałych pożna zobaczyć na zsp3a.za.pl)
Go to the top of the page
+Quote Post
fiszol
post 16.06.2007, 20:00:43
Post #7





Grupa: Zarejestrowani
Postów: 452
Pomógł: 16
Dołączył: 25.05.2004
Skąd: Gorzów Wlkp.

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


wywal ze swojego kodu error_reporting(false); i dodaj to na samym początku:

  1. <?php
  2. if(!ini_set('error_reporting', E_ALL | E_STRICT))
  3. {
  4. echo 'błąd, zmiana ustawień dla error_reporting nie powiodła się';
  5. }
  6. if(!ini_set('display_errors', 'On'))
  7. {
  8. echo 'błąd, zmiana ustawień dla display_errors nie powiodła się';
  9. }
  10. ?>

teraz musi coś wyświetlić


--------------------
\o/
Go to the top of the page
+Quote Post
Piotrwusek
post 16.06.2007, 20:11:38
Post #8





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


tak samo ni sie nie dzieje
Go to the top of the page
+Quote Post
Ziels
post 16.06.2007, 23:44:17
Post #9





Grupa: Zarejestrowani
Postów: 235
Pomógł: 2
Dołączył: 30.06.2006

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


Cytat(fiszol @ 16.06.2007, 21:00:43 ) *
wywal ze swojego kodu error_reporting(false); i dodaj to na samym początku:

  1. <?php
  2. if(!ini_set('error_reporting', E_ALL | E_STRICT))
  3. {
  4. echo 'błąd, zmiana ustawień dla error_reporting nie powiodła się';
  5. }
  6. if(!ini_set('display_errors', 'On'))
  7. {
  8. echo 'błąd, zmiana ustawień dla display_errors nie powiodła się';
  9. }
  10. ?>

teraz musi coś wyświetlić



Nie musi, musiało by gdybyś die() dał miast echo
Go to the top of the page
+Quote Post
Darti
post 16.06.2007, 23:56:54
Post #10





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


tą część z warunkiem zastąp tym, może już zadziała (a przynajmniej coś się wyświetli) :
  1. <?php
  2. $a = url_exists("http://www.zsp3a.za.pl/includes/kolumna-lewa.php");
  3.  
  4. if($a == False) {
  5. echo('<td width="3"></td><td width="201">');
  6. require("includes/kolumna-lewa.php");
  7. echo('</td><td width="700"></td><td width="3"></td>');
  8. } else {
  9. echo('<td width="3"></td><td width="201">');
  10. require("includes/kolumna-lewa.php");
  11. echo ('</td><td width="500"></td><td width="201"></td><td width="3"></td>');
  12. }
  13. ?>


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
Piotrwusek
post 17.06.2007, 10:27:16
Post #11





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


dzięki działa ale jeszcze trochę kuleje
powstał taki skrypt

  1. <?php
  2. /*
  3.  
  4. Copyright (c) 2007 Piotrwusek
  5.  
  6. Released under the GNU General Public License
  7. */
  8. if(!ini_set('error_reporting', E_ALL | E_STRICT))
  9. {
  10. echo 'błąd, zmiana ustawień dla error_reporting nie powiodła się ';
  11. }
  12. if(!ini_set('display_errors', 'On'))
  13. {
  14. echo '< błąd, zmiana ustawień dla display_errors nie powiodła się ';
  15. }
  16.  
  17.  
  18.  
  19.  function url_exists($url) {
  20. $x = fopen($url, "r");
  21. if($x == False) {
  22. return False;
  23. } else {
  24. return True;
  25. }
  26. }
  27.  
  28.  
  29.  
  30. include("includes/language/polish.php");
  31. ?>
  32. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  33. <html>
  34. <head>
  35. <meta name="verify-v1" content="<?php echo GOOGLE; ?>" />
  36. <link rel="SHORTCUT ICON" href="<?php echo IKONA; ?>">
  37. <meta http-equiv="content-type" content="<?php echo KODOWANIE; ?>" />
  38. <meta name="author" content="<?php echo AUTOR; ?>" />
  39. <meta name="description" content="Strona klasy 3a gimnazjum" />
  40. <meta name="keywords" content="<?php echo KEYWORDS; ?>" />
  41. <meta name="copyright" content="<?php echo PRAWA; ?>" />
  42. <meta http-equiv="content-language" content="pl" />
  43. <meta name="distribution" content="GLOBAL" />
  44. <link rel="stylesheet" href="stylesheet.css" type="text/css" />
  45. <title><?php echo TITLE; ?></title>
  46. </head>
  47. <body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" background="images/strona/tlo.bmp">
  48. <table border="0" width="908" height="" align="CENTER" valign="TOP" cellspacing="0" cellpadding="0" bgcolor="white">
  49. <tr>
  50. <td background="images/strona/tabela-prawo.bmp" width="11"></td>
  51. <td><?php require("includes/header.php"); ?>
  52. <table border="1" align="CENTER" valign="TOP" cellspacing="0" cellpadding="0" leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0">
  53. <tr>
  54.  
  55. <?php
  56. $a = url_exists("http://www.zsp3a.za.pl/includes/kolumna-lewa.php");
  57.  
  58. if($a == True) {
  59. echo('<td width="3"></td><td width="201">');
  60. require("includes/kolumna-lewa.php");
  61. echo('</td><td width="700"><table border="0" width="700" align="JUSTIFY" valign="TOP" cellspacing="0" cellpadding="0">
  62. <tr>
  63. <td><php require("includes/zawartosc.php"); ?></td>
  64. </tr>
  65. </table></td><td width="3"></td>');
  66. } else {
  67. echo('<td width="3"></td><td width="201">');
  68. require("includes/kolumna-lewa.php");
  69. echo ('</td><td width="500"><table border="0" width="500" align="JUSTIFY" valign="TOP" cellspacing="0" cellpadding="0">
  70. <tr>
  71. <td><?php require("inludes/zawartosc.php"); ?></td>
  72. </tr>
  73. </table></td><td width="201"><?php require("includes/kolumna-lewa.php"); ?></td><td width="3"></td>');
  74. }
  75. ?>
  76. </tr>
  77. </table>
  78.  
  79. <?php require("includes/stopka.php"); ?></td>
  80.  
  81. <td background="images/strona/tabela-lewo.bmp" width="11"></td>
  82. </tr>
  83. <tr background="images/strona/tabela-dol_1.bmp" height="10" widht="201"></tr>
  84. <td ></td>
  85. <td></td>
  86. </table>
  87. <br />
  88. </body>
  89. </html>


a na stronie wyświetla sie

błąd, zmiana ustawień dla display_errors nie powiodła się błąd, zmiana ustawień dla error_reporting nie powiodła się



co robić
Go to the top of the page
+Quote Post
Darti
post 17.06.2007, 11:30:18
Post #12





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


Bo prawidłowo powinno być raczej tak:
  1. <?php
  2. ini_set('display_errors', 'On');
  3. ini_set('error_reporting', E_ALL | E_STRICT);
  4.  
  5. if (ini_get('error_reporting') != 4095))
  6. {
  7. echo 'błąd, zmiana ustawień dla error_reporting nie powiodła się ';
  8. }
  9. if(ini_get('display_errors') != 'On'))
  10. {
  11. echo '< błąd, zmiana ustawień dla display_errors nie powiodła się ';
  12. }
  13. ?>


Jeżeli w dalszym ciągu będzie wyskakiwało że "nie powiodło się" to znaczy że nie masz praw do stosowania funkcji ini_set i albo będziesz działał inaczej albo zrezygnujesz z raportowania błędów.

Ten post edytował Darti 17.06.2007, 11:31:28


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
Piotrwusek
post 17.06.2007, 11:53:10
Post #13





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


Cytat(Darti @ 17.06.2007, 12:30:18 ) *
Bo prawidłowo powinno być raczej tak:
  1. <?php
  2. ini_set('display_errors', 'On');
  3. ini_set('error_reporting', E_ALL | E_STRICT);
  4.  
  5. if (ini_get('error_reporting') != 4095))
  6. {
  7. echo 'błąd, zmiana ustawień dla error_reporting nie powiodła się ';
  8. }
  9. if(ini_get('display_errors') != 'On'))
  10. {
  11. echo '< błąd, zmiana ustawień dla display_errors nie powiodła się ';
  12. }
  13. ?>


Jeżeli w dalszym ciągu będzie wyskakiwało że "nie powiodło się" to znaczy że nie masz praw do stosowania funkcji ini_set i albo będziesz działał inaczej albo zrezygnujesz z raportowania błędów.



z tym kodem to wogóle nie działa
Go to the top of the page
+Quote Post
Darti
post 17.06.2007, 13:01:55
Post #14





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


Cytat(Piotrwusek @ 17.06.2007, 10:53:10 ) *
z tym kodem to wogóle nie działa


To coś źle wkleiłeś ...


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
Piotrwusek
post 18.06.2007, 10:05:10
Post #15





Grupa: Zarejestrowani
Postów: 399
Pomógł: 7
Dołączył: 11.06.2007
Skąd: Poznan

Ostrzeżenie: (20%)
X----


a może ktoś zrobi mi takie coś questionmark.gif
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: 15.08.2025 - 03:13