Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> start1.php?=jak to zrobić
Riddick
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


Jestem bardzo początkujący w php i niewiem jak to zrobić 1.php?=strona chcę to umieścić na mojej stronce:

A mianowicie jak wejdę na moją www http://mixnet.ovh.org/test/gry.php i potem klikam na newsy to jak zrobić by tam po środku w tej białej ramce mi wyskoczyła zawartość newsgry.php . Chodzi mi tu jak zrobić to funkcją include.

Kod
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<meta name="" content="">
<title></title>
<link rel="Stylesheet" type="text/css" href="style.css">
</head>
<body>

<table id="top">
<tr>
    <td id="left_border">&nbsp;</td>
    <td id="center">
  <table id="body">
  <tr>
      <td colspan="2" id="header">
    <div id="control">&nbsp;
    </div>
      
      </td>
  </tr>
  <tr><td colspan="2" id="top_menu"><a href="newsgry.php">Newsy</a>&nbsp;| <a href="">Recenzje</a>&nbsp;| <a href="">Kody</a>&nbsp;| <a href="">Łatki/Patche</a>&nbsp;| <a href=""></a></td></tr>
  <tr><td colspan="2" id="top_menu_border">&nbsp;</td></tr>
  <tr>
      <td id="left">
    <table class="menu">
    <tr><th>Rodzaje Gier</th></tr>
    <tr>
        <td class="links">
      <span class="dot">&raquo;</span> <a href="">Bijatyki</a><br>
      <span class="dot">&raquo;</span> <a href="">Strzelaniny</a><br>
      <span class="dot">&raquo;</span> <a href="">Zręcznościowe</a><br>
      <span class="dot">&raquo;</span> <a href="">Edukacyjne</a><br>
      <span class="dot">&raquo;</span> <a href="">cRPG</a><br>
      <span class="dot">&raquo;</span> <a href="">Logiczne</a><br>
      <span class="dot">&raquo;</span> <a href="">Przygodowe</a><br>
      <span class="dot">&raquo;</span> <a href="">Sieciowe</a><br>
      <span class="dot">&raquo;</span> <a href="">Sportowe</a><br>
      <span class="dot">&raquo;</span> <a href="">Strategiczne</a><br>
      <span class="dot">&raquo;</span> <a href="">Symulacyjne</a><br>
      <span class="dot">&raquo;</span> <a href="">Wyścigowe</a><br>
      <span class="dot">&raquo;</span> <a href="">Dzwiękowe</a><br>
        </td>
    </tr>
    <tr><th class="footer">&nbsp;</th></tr>
    </table>
    <br>
    <table class="menu">
    <tr><th>Top 5 Gier</th></tr>
    <tr>
        <td class="card">
      
        </td>
    </tr>
    <tr><th class="footer">&nbsp;</th></tr>
    </table>
    <br>
    <table class="menu">
    <tr><th>Reklama</th></tr>
    <tr>
        <td class="card">
      
        </td>
    </tr>
    <tr><th class="footer">&nbsp;</th></tr>
    </table>
      </td>
      <td id="content">
    <table class="menu">
    <tr><th></th></tr>
    <tr>
        <td>
      <!-- CONTENT -->
*// to jest te miejce gdzie jak coś napisze to w tej ramce będzie pisać, a mi chodzi żeby w to miejsce się ładowała zawartość newsgry.php funkcją include.
      <!-- /CONTENT -->
        </td>
    </tr>
    <tr><th class="footer">&nbsp;</th></tr>
    </table>
      </td>
  </tr>
  <tr><td colspan="2" id="footer_border">&nbsp;</td></tr>
  <tr><td colspan="2" id="footer">&copy;Project Riddick by HCG TeAm - 2006 <a href="index.php"><-- Powrót do strony głównej</a></td></tr>
  </table>
    </td>
    <td id="right_border">&nbsp;</td>
</tr>
</table>

</body>
</html>


A niewiem czy to potrzebne zawartość pliku style.css
Kod
body, td, th, caption {
    color: #000000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

body {
    background: #FFFFFF url("body.gif");
    margin: 0;
    padding: 0;
    text-align: center;
}

table {
    border-collapse: collapse;
}


table#top {
    width: 780px;
    margin: 0 auto;
    text-align: left;
    background: #E0E0E0;
}


td#left_border {
    background: url("left_border.gif");
    width: 10px;
    padding: 0;
    font-size: 10px;
}

td#center {
    width: 760px;
    padding: 0;
}

td#right_border {
    background: url("right_border.gif");
    width: 10px;
    padding: 0;
    font-size: 10px;
}


table#body {
    width: 760px;
}

/* <HEADER> */
td#header {
    background: url("header.gif");
    text-align: right;
    vertical-align: top;
    height: 100px;
    padding: 5px 10px;
}

td#header #control {
    height: 22px;
}

td#header #control img {
    width: 20px;
    height: 20px;
}

td#header #banner {
    width: 400px;
    height: 50px;
    margin-top: 10px;
}
/* </HEADER> */

td#top_menu {
    background: #C0C0C0 url("top_menu.gif");
    color: #808080;
    text-align: center;
    vertical-align: middle;
    height: 30px;
    font-size: 12px;
    padding: 0;
}

td#top_menu_border {
    background: url("top_menu_border.gif");
    height: 12px;
    padding: 0;
    font-size: 10px;
}

td#left {
    width: 150px;
    text-align: center;
    vertical-align: top;
    padding: 0;
}

td#content {
    text-align: left;
    vertical-align: top;
    padding: 0;
}

td#footer_border {
    background: url("footer_border.gif");
    height: 12px;
    padding: 0;
    font-size: 10px;
}

td#footer {
    background: #C0C0C0 url("footer.gif");
    color: #808080;
    font-size: 11px;
    height: 25px;
    text-align: center;
    vertical-align: middle;
    padding: 0;
}


/* <MENU> */
table.menu {
    width: 100%;
}

table.menu th {
    background: #C0C0C0 url("menu_header.gif");
    color: #808080;
    text-align: center;
    vertical-align: middle;
    font-weight: bold;
    font-size: 12px;
    height: 25px;
    padding: 0;
}

table.menu td {
    background: #FFFFFF url("menu.gif");
    color: #808080;
    text-align: left;
    vertical-align: top;
    padding: 5px 7px;
    font-size: 11px;
}

table.menu th.footer {
    background: #FFFFFF url("menu_footer.gif");
    padding: 0;
    font-size: 10px;
    height: 10px;
}
/* </MENU> */

/* <MENU card> */
table.menu td.card {
    text-align: center;
    font-size: 11px;
}

table.menu td.card img {
    margin: 2px;
}
/* </MENU card> */

/* <MENU left> */
td#left table.menu {
    width: 140px;
    margin: 0 auto;
}
/* </MENU left> */

/* <MENU content> */
td#content table.menu {
    width: 605px;
}

td#content table.menu th {
    background-image: url("content_header.gif");
}
td#content table.menu td {
    background: #FFFFFF url("content.gif");
    color: #000000;
    font-size: 11px;
    text-align: justify;
    padding: 10px 10px 30px 10px;
}

td#content table.menu th.footer {
    background: #FFFFFF url("content_footer.gif");
}
/* </MENU content> */

td#content table.menu td table th, td#content table.menu td table td {
    padding: 1px;
    background-color: transparent;
    background-image: none;
}

.dot {
    color: #000080;
    font-weight: bold;
}

/* <A> */
/* <A top_menu> */
td#top_menu a:link, td#top_menu a:visited {
    color: #808080;
    font-weight: bold;
    text-decoration: none;
}

td#top_menu a:hover {
    color: #000080;
}
/* </A top_menu> */

/* <A menu> */
table.menu a:link, table.menu a:visited {
    color: #808080;
    font-weight: normal;
    text-decoration: none;
}

table.menu a:hover {
    color: #000080;
}
/* </A menu> */

/* <A content> */
td#content a:link, td#content a:visited {
    color: #0040B0;
    font-weight: normal;
    text-decoration: none;
}

td#content a:hover {
    color: #0000FF;
    text-decoration: underline;
}
/* </A content> */

/* <A foter> */
td#footer a:link, td#footer a:visited, td#footer a:hover {
    color: #808080;
    font-weight: normal;
    text-decoration: none;
}
/* </A foter> */
/* </A> */
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 16)
Kuziu
post
Post #2





Grupa: Zarejestrowani
Postów: 743
Pomógł: 0
Dołączył: 11.11.2003
Skąd: Toruń

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


To może zacznij od podstaw jakiś kurs itp.

include to naprawde podstawowa funkcja

  1. <?php
  2. include('nazwaPliku.php');
  3. ?>


Gotowe

Do tego manual include()

A kursy masz tez na forum wypisane
Go to the top of the page
+Quote Post
Lee
post
Post #3





Grupa: Zarejestrowani
Postów: 319
Pomógł: 0
Dołączył: 11.04.2006
Skąd: Chojnów

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


Kiedy się nauczą, przeczytaj >>TO<<, było też kilka tematów o tym...
Go to the top of the page
+Quote Post
Riddick
post
Post #4





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


Wydaje mi się że coś źle zrobiłem, napewno źle


Kod
</tr>
  <tr><td colspan="2" id="top_menu"><a href="
<?php
include('newsygry.php');
?>
">Newsy</a>&nbsp;|


Tak wstawiłem, ja naprawde jestem zielony w php, próbóje się go uczyć ale nie bardzo mi wychodzi.
Go to the top of the page
+Quote Post
Master Miko
post
Post #5





Grupa: Zarejestrowani
Postów: 530
Pomógł: 0
Dołączył: 15.01.2005
Skąd: Warszawa

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


Kup sobie książkę, coś w stylu ABC php, albo... poszukaj:

www.helion.pl (moim zdaniem najlepsze książki, choć są też innych wydawnictw)

---
~Master Miko i co tym wniosłeś to tematu? Nic.
Pisz na temat, albo nie nabijaj postów, bo ja je liczę i możesz dostać ostrzeżenie.
~mike_mech
Go to the top of the page
+Quote Post
Riddick
post
Post #6





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


No musze zamówić coś dla siebie, ale to jest właściwy dział i moglibyście mnie troche oświecić i pomóc mi.
Go to the top of the page
+Quote Post
Kuziu
post
Post #7





Grupa: Zarejestrowani
Postów: 743
Pomógł: 0
Dołączył: 11.11.2003
Skąd: Toruń

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


Napisalismy Ci jak to zrobic ale skoro nie znasz nawet podstaw to co to Ci da ze napiszemy 1 czy 2 rzeczy za Ciebie jak zaraz przybiegniesz z 3,4,5,........ i tak bez końca.

Tutaj raczej pomaga się gdy ktoś czegoś nie rozumie mimo że próbuje i zna odpowiednie funkcje a nie że Ty nawet nie zajrzałeś do kursu i my mamy za Ciebie coś zrobić
Go to the top of the page
+Quote Post
Riddick
post
Post #8





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


Akurat kurs czytałem!!
Go to the top of the page
+Quote Post
Kuziu
post
Post #9





Grupa: Zarejestrowani
Postów: 743
Pomógł: 0
Dołączył: 11.11.2003
Skąd: Toruń

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


To przeczytaj jeszcze raz bo to jest w każdym jednym kursie
Go to the top of the page
+Quote Post
mike
post
Post #10





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Ptzde wszystkim zeby dostać odpowiedx to trzeba mądrze zapytać.
"Wydaje mi się że coś źle zrobiłem" - a moze się podzielisz z nami dlaczego tak Ci się wydaje?
Coś nie działa jak powinno? Jeśli tak to jak działa, a jak powinno?
Wywala błędy? Jakie?

Po drugie to korzystaj z odpowiednich tagów bbCode.
[ code ] to nie wszystko. jest jeszcze [ html ] i [ php ]

Po trzecie kod, który podałes jest poprawny o ile plik jest interpretowany przez php (posuada rozszerzenie .php a na serwerze jest zainstalowany interpreter php) i plik newsygry.php znajduje sie w odpowiednim miejscu.

---update (2006-04-29 12:41:02)---
Każdy kolejny, który wspomni o kursie lub o książce dostaje ostrzeżenie.
Umowa stoi? (pytanie retoryczne (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) )
Go to the top of the page
+Quote Post
Riddick
post
Post #11





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


Wszystko jest w tym samym folderze czyli /test/ ma rozszerzenie php i serwer ma interpretator php. Ja mam tylko problem z tym że chcę funkcją include załadować zawartość pliku newsgry.php do tej środkowej ramki.
Go to the top of the page
+Quote Post
mike
post
Post #12





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Jeśli plik index.php (zakładam że to plik główny) i plik newsygry.php sa obok siebie w drzewie folderów i masz kod:

  1. <div>
  2. <?php
  3.  
  4. include( 'newsygry.php' );
  5.  
  6. ?>
  7. </div>


To wszystko powinno byc dobrze i w ploku <div> powinienes ujrzeć zawartosć pliku newsygry.php o ile z kolei ten coś wyświetla.

Możesz pokazać co w nim się znajduje?
Go to the top of the page
+Quote Post
Riddick
post
Post #13





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


plik newsgry.php jest pusty, ma tylko w sobie txt "to jest mój problem"
Go to the top of the page
+Quote Post
mike
post
Post #14





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


index.php
  1. <div>
  2. <?php
  3.  
  4. include( 'newsygry.php' );
  5.  
  6. ?>
  7. </div>


newsgry.php
Kod
to jest mój problem


Wynik:
  1. <div>to jest mój problem</div>


To musi działać i kropka.
Go to the top of the page
+Quote Post
Riddick
post
Post #15





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


no dobrze tylko to niema się ładować bezpośrednio po włączeniu strony tylko jak klikne na odnośnik Newsy wtedy powinno się ładować plik newsygry.php do tej środkowej ramki.
Go to the top of the page
+Quote Post
mike
post
Post #16





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Link daj tak:
  1. <a href="index.php?strona=news">Newsy</a>


  1. <div>
  2. <?php
  3.  
  4. if( ! empty( $_GET[ 'strona' ] ) && $_GET[ 'strona' ] == 'news' )
  5. {
  6. include( 'newsygry.php' );
  7. }
  8. else
  9. {
  10. echo 'Domyślna treść';
  11. // lub
  12. include( 'default.php' );
  13. }
  14.  
  15. ?>
  16. </div>
Go to the top of the page
+Quote Post
Riddick
post
Post #17





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.04.2006

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


Zobaczcie sobie działa: http://mixnet.ovh.org/test/gry.php?strona=newsgry.php , kliknijcie na link newsy, tylko że nie ładuje treście z pliku newsgry.php do tej środkowej ramki.



PS
może wam się nie wyświetlić strona bo dziś coś serwer w kulki leci.
Go to the top of the page
+Quote Post

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: 24.08.2025 - 21:24