Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Wyświetla tylko jedna strone
Forum PHP.pl > Forum > Przedszkole
Sikor89
Witam,
na wstepie napisze, ze jestem bardzo slaby w php, mam nadzieje, ze uda mi sie tutaj odnalezc pomoc;) Do rzeczy:
Klikajac w jakikolwiek link na stronie wyswietla sie tylko jedna strona, adres zmiania sie jednak strona glowna nie. Probklem taki jak tu: http://www.dictum.netlook.pl/tpe/ Gdy klikamy z lewej strony mendu link "statut" to statut sie nie wyswietla. Oczywiscie wszystko jest na serwerze:)
Pozdrawiam
wookieb
A kod to nie łaska podać?
Sikor89
CODE























































Witam Serdecznie na stronach Towarzystwa Przyjaciół Elfidy!!
Jako stowarzyszenie stawiamy sobie za cel przydewszystkim dobro naszej ukochanej prowincji, jej rozwój i rozkwit.
Zachęcamy do wspierania naszych wysiłków.







$page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
if(file_exists("images/$page1.png"))
echo"






";
else
echo"";
?>





$page="index";
}
if(file_exists("includes/$page.inc")) {
include "includes/$page.inc";
} else {
echo "Strona niedostępna!";
}
?>








blooregard
Cytat
W związki ze śmiercią założyciela i przewodniczącego TPE Tomasza Wyspiańskiego i nie wybrania nowego przewodniczącego TPE zostaje zmienione w muzeum. Jego strony zostają udostępnione wszystkim jako zbiór wielu istotnych i cennych informacji.


Wydaje mi się, że to wyjaśnia wszystko...
Foxx
blooregard, myślę że jednak jest tam jakiś problem - zmieniają się nagłówki a treść nie.
Sikor89
Nie, nie wyjasnia, strony powinny dzialac:)
blooregard
Po wpisaniu tego w pasku adresu:
Cytat

wyświetla się chyba to, co powinno po kliknięciu w link "Mapa" w menu głównym.

Czyli problem jest w index.php w przypuszczalnie takiej inijce:
Kod
include($_GET['parametr'].'.php');

albo coś w tym stylu...
Foxx
Sikor89, napisałem Ci na PW już - umieść kod w znacznikach bbcode bo chciałbym Ci pomóc ale teraz kod jest nieczytelny.
Sikor89
CODE


Towarzystwo Przyjaciół Elfidy






























Witam Serdecznie na stronach Towarzystwa Przyjaciół Elfidy!!
Jako stowarzyszenie stawiamy sobie za cel przydewszystkim dobro naszej ukochanej prowincji, jej rozwój i rozkwit.
Zachęcamy do wspierania naszych wysiłków.














$page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
if(file_exists("images/$page1.png"))
echo"";
else
echo"";
?>





$page="index";
}
if(file_exists("includes/$page.inc")) {
include "includes/$page.inc";
} else {
echo "Strona niedostępna!";
}
?>






























Foxx
Sikor89 - znaczniki PHP a nie CODE
Sikor89
  1. <html>
  2.  <head>
  3.  <title>Towarzystwo Przyjaciół Elfidy</title>
  4.  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  5.  <link rel="stylesheet" href="style.css" type="text/css">
  6.  </head>
  7.  
  8.  <body bgcolor="#008080" text="#FFF8DC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#FFF8DC" vlink="#FFF8DC" alink="#FFF8DC">
  9.  <table width="780" border="0" cellspacing="0" cellpadding="0" class="body" align="center">
  10.    <tr>
  11.      <td width="850" height="85" valign="top">
  12.  <? include "includes/top.inc"; ?>
  13.  
  14.  
  15.  </td>
  16.    </tr>
  17.    <tr>
  18.      <td valign="top" width="850">
  19.        <table width="760" border="0" cellspacing="0" cellpadding="0">
  20.          <tr valign="top">
  21.            <td width="165" background="images/menu.png">
  22.  
  23.  <? include "includes/menu.inc"; ?>
  24.  </td>
  25.            <td>
  26.              <table width="600" border="0" cellspacing="0" cellpadding="0" class="top">
  27.                <tr>
  28.                  <td height="18" background="images/newst2.png" valign="top">&nbsp;</td>
  29.                </tr>
  30.                <tr>
  31.                  <td background="images/newstl.png" valign="top">
  32.                    <table width="600" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  33.                      <tr>
  34.                        <td><center>Witam Serdecznie na stronach Towarzystwa Przyjaciół Elfidy!!
  35.  Jako stowarzyszenie stawiamy sobie za cel przydewszystkim dobro naszej ukochanej prowincji, jej rozwój i rozkwit.
  36.  Zachęcamy do wspierania naszych wysiłków.</center>
  37.                          
  38.                        </td>
  39.                      </tr>
  40.                    </table>
  41.                  </td>
  42.                </tr>
  43.                <tr>
  44.                  <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  45.                </tr>
  46.              </table>
  47.              
  48.  
  49.              <table width="431" border="0" cellspacing="0" cellpadding="0" class="top">
  50.                <tr>
  51.  <?
  52.  $page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
  53.  if(file_exists("images/$page1.png"))
  54.  echo"<td height=\"31\" background=\"images/$page1.png\" valign=\"top\">";
  55.  else
  56.  echo"<td height=\"31\" background=\"images/blank.png\" valign=\"top\">";
  57.  ?>
  58.                </tr>
  59.                <tr>
  60.                  <td background="images/newstl.png" valign="top">
  61.                    <table width="550" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  62.                      <tr>
  63.                        <td><? if(!isset($page)) {
  64.  $page="index";
  65.  }
  66.  if(file_exists("includes/$page.inc")) {
  67.  include "includes/$page.inc";
  68.  } else {
  69.  echo "Strona niedostępna!";
  70.  }
  71.  ?>  
  72.                        </td>
  73.                      </tr>
  74.                    </table>
  75.                  </td>
  76.                </tr>
  77.                <tr>
  78.                  <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  79.                </tr>
  80.              </table>
  81.              <p>&nbsp;</p>
  82.            </td>
  83.  
  84.  
  85.  
  86.  </font></div>
  87.            </td>
  88.          </tr>
  89.        </table>
  90.      </td>
  91.    </tr>
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  </table>
  99.  </body>
  100.  </html>
Foxx
W tym fragmencie:
  1. <?php
  2. if(!isset($page)) {
  3. $page="index";
  4. }
  5. if(file_exists("includes/$page.inc")) {
  6. include "includes/$page.inc";
  7. } else {
  8. echo "Strona niedostępna!";
  9. }
  10. ?>

Zmień wszędzie zmienną $page na $page1 bo taka jest parę linijek wyżej inicjowana.
Natomiast zmienna $page nie jest inicjowana nigdzie i dlatego zawsze przypisywana jest do niej wartość "index" i wyświetlana jest zawsze strona index.inc.
Sikor89
Prawie wszystko jest ok tylko nie wyswietla glownej strony z newsami.
http://www.dictum.netlook.pl/tpe/index.php
Foxx
Pokaż jak teraz wygląda Twój kod.
Sikor89
  1. <html>
  2. <head>
  3. <title>Towarzystwo Przyjaciół Elfidy</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  5. <link rel="stylesheet" href="style.css" type="text/css">
  6. </head>
  7.  
  8. <body bgcolor="#008080" text="#FFF8DC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#FFF8DC" vlink="#FFF8DC" alink="#FFF8DC">
  9. <table width="780" border="0" cellspacing="0" cellpadding="0" class="body" align="center">
  10.  <tr>
  11.    <td width="850" height="85" valign="top">
  12. <? include "includes/top.inc"; ?>
  13.  
  14.  
  15. </td>
  16.  </tr>
  17.  <tr>
  18.    <td valign="top" width="850">
  19.      <table width="760" border="0" cellspacing="0" cellpadding="0">
  20.        <tr valign="top">
  21.          <td width="165" background="images/menu.png">
  22.  
  23. <? include "includes/menu.inc"; ?>
  24. </td>
  25.          <td>
  26.            <table width="600" border="0" cellspacing="0" cellpadding="0" class="top">
  27.              <tr>
  28.                <td height="18" background="images/newst2.png" valign="top">&nbsp;</td>
  29.              </tr>
  30.              <tr>
  31.                <td background="images/newstl.png" valign="top">
  32.                  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  33.                    <tr>
  34.                      <td><center>Witam Serdecznie na stronach Towarzystwa Przyjaciół Elfidy!!<br>Jako stowarzyszenie stawiamy sobie za cel przydewszystkim dobro naszej ukochanej prowincji, jej rozwój i rozkwit.<br>Zachęcamy do wspierania naszych wysiłków.</center>
  35.                        
  36.                      </td>
  37.                    </tr>
  38.                  </table>
  39.                </td>
  40.              </tr>
  41.              <tr>
  42.                <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  43.              </tr>
  44.            </table>
  45.            <br>
  46.            <table width="431" border="0" cellspacing="0" cellpadding="0" class="top">
  47.              <tr>
  48. <?
  49. $page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
  50. if(file_exists("images/$page1.png"))
  51. echo"<td height=\"31\" background=\"images/$page1.png\" valign=\"top\">";
  52. else
  53. echo"<td height=\"31\" background=\"images/blank.png\" valign=\"top\">";
  54. ?>
  55.              </tr>
  56.              <tr>
  57.                <td background="images/newstl.png" valign="top">
  58.                  <table width="550" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  59.                    <tr>
  60.                      <td><? if(!isset($page)) {
  61. $page="index";
  62. }
  63. if(file_exists("includes/$page1.inc")) {
  64. include "includes/$page1.inc";
  65. } else {
  66. echo "Strona niedostępna!";
  67. }
  68. ?>  
  69.                      </td>
  70.                    </tr>
  71.                  </table>
  72.                </td>
  73.              </tr>
  74.              <tr>
  75.                <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  76.              </tr>
  77.            </table>
  78.            <p>&nbsp;</p>
  79.          </td>
  80.  
  81.  
  82.  
  83. </font></div>
  84.          </td>
  85.        </tr>
  86.      </table>
  87.    </td>
  88.  </tr>
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. </table>
  96. </body>
  97. </html>
Foxx
Tu także musisz zmienić na $page1:
  1. <?php
  2. if(!isset($page)) {
  3. $page="index";
  4. }
  5. ?>


Czyli:
  1. <?php
  2. if(!isset($page1)) {
  3. $page1 = "index";
  4. }
  5. ?>
Spawnm
  1. <td><? if(!isset($page)) {
  2. $page="index";
  3. }
  4. if(file_exists("includes/$page1.inc")) {
  5. include "includes/$page1.inc";
  6. } else {
  7. echo "Strona niedostępna!";
  8. }
  9. ?>

po co ta zmienna?

  1. <?php
  2. $page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
  3. if(file_exists("images/$page1.png"))
  4. echo"<td height=\"31\" background=\"images/$page1.png\" valign=\"top\">";
  5. ?>

tu czasem nie ma literówki ? newst ?
Sikor89
Nadal nie wyswietla glownej strony
  1. <html>
  2. <head>
  3. <title>Towarzystwo Przyjaciół Elfidy</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  5. <link rel="stylesheet" href="style.css" type="text/css">
  6. </head>
  7.  
  8. <body bgcolor="#008080" text="#FFF8DC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#FFF8DC" vlink="#FFF8DC" alink="#FFF8DC">
  9. <table width="780" border="0" cellspacing="0" cellpadding="0" class="body" align="center">
  10.  <tr>
  11.    <td width="850" height="85" valign="top">
  12. <? include "includes/top.inc"; ?>
  13.  
  14.  
  15. </td>
  16.  </tr>
  17.  <tr>
  18.    <td valign="top" width="850">
  19.      <table width="760" border="0" cellspacing="0" cellpadding="0">
  20.        <tr valign="top">
  21.          <td width="165" background="images/menu.png">
  22.  
  23. <? include "includes/menu.inc"; ?>
  24. </td>
  25.          <td>
  26.            <table width="600" border="0" cellspacing="0" cellpadding="0" class="top">
  27.              <tr>
  28.                <td height="18" background="images/newst2.png" valign="top">&nbsp;</td>
  29.              </tr>
  30.              <tr>
  31.                <td background="images/newstl.png" valign="top">
  32.                  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  33.                    <tr>
  34.                      <td><center>Witam Serdecznie na stronach Towarzystwa Przyjaciół Elfidy!!<br>Jako stowarzyszenie stawiamy sobie za cel przydewszystkim dobro naszej ukochanej prowincji, jej rozwój i rozkwit.<br>Zachęcamy do wspierania naszych wysiłków.</center>
  35.                        
  36.                      </td>
  37.                    </tr>
  38.                  </table>
  39.                </td>
  40.              </tr>
  41.              <tr>
  42.                <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  43.              </tr>
  44.            </table>
  45.            <br>
  46.            <table width="431" border="0" cellspacing="0" cellpadding="0" class="top">
  47.              <tr>
  48. <?
  49. $page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
  50. if(file_exists("images/$page1.png"))
  51. echo"<td height=\"31\" background=\"images/$page1.png\" valign=\"top\">";
  52. else
  53. echo"<td height=\"31\" background=\"images/blank.png\" valign=\"top\">";
  54. ?>
  55.              </tr>
  56.              <tr>
  57.                <td background="images/newstl.png" valign="top">
  58.                  <table width="550" border="0" cellspacing="0" cellpadding="0" align="center" class="body">
  59.                    <tr>
  60.                      <td><? if(!isset($page1)) {
  61. $page1="index";
  62. }
  63. if(file_exists("includes/$page1.inc")) {
  64. include "includes/$page1.inc";
  65. } else {
  66. echo "Strona niedostępna!";
  67. }
  68. ?>  
  69.                      </td>
  70.                    </tr>
  71.                  </table>
  72.                </td>
  73.              </tr>
  74.              <tr>
  75.                <td background="images/news_back.png" valign="bottom"><img src="images/newsb.png" width="600" height="25"></td>
  76.              </tr>
  77.            </table>
  78.            <p>&nbsp;</p>
  79.          </td>
  80.  
  81.  
  82.  
  83. </font></div>
  84.          </td>
  85.        </tr>
  86.      </table>
  87.    </td>
  88.  </tr>
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. </table>
  96. </body>
  97. </html>
Spawnm
  1. <?php
  2. $page1 = isset($_GET['page']) ? $_GET['page'] : "newst" ;
  3. ?>

zmień na
  1. <?php
  2. $page1 = (isset($_GET['page']) ) ? $_GET['page'] : "newst" ;
  3. ?>


//zobacz czy na pewno plik się nazywa newst a nie news.
Foxx
Ok, to zamień to:
  1. <?php
  2. if(!isset($page1)) {
  3.  $page1="index";
  4. }
  5. ?>

na:
  1. <?php
  2. if(!isset($_GET['page'])) {
  3.  $page1="index";
  4. }
  5. ?>
Sikor89
Wszystko ok, wielkie dzieki! pomogl
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.