Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> wyswietlanie podstrony
djtomaszq
post
Post #1





Grupa: Zarejestrowani
Postów: 192
Pomógł: 0
Dołączył: 5.07.2015

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


Jak można rozwiązać problem jeśli chce na stronie index.php w miejscu div wstawić przez include inną stronę.

dodam, że kod index.ph do tego mam taki:

  1. CASE "strona":
  2. INCLUDE 'pokaz.php?id=3';
  3. BREAK;


i w pliku profil.php chce po kliknieciu na link kodzie nizej zeby wyswietlila sie strona pokaz.php indexu np. nr 3:

  1. <a href="index.php?parent=strona">



.. i wtedy spotykam błąd

  1. Warning: include(pokaz.php?id=3) [function.include]: failed to open stream: No error in C:\Program Files\WebServ\httpd-users\w\index.php on line 45
  2.  
  3. Warning: include() [function.include]: Failed opening 'pokaz.php?id=3' for inclusion (include_path='.;C:\php5\pear') in C:\Program Files\WebServ\httpd-users\w\index.php on line 45
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
djtomaszq
post
Post #2





Grupa: Zarejestrowani
Postów: 192
Pomógł: 0
Dołączył: 5.07.2015

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


index.php
  1. CASE "strona":
  2. $id = 3;
  3. include 'pokaz.php';
  4. BREAK;


profil.php
  1. $user_data = get_user_data();
  2. echo '<div style="float: left; margin-bottom: 5px;" style="width: 200px;" align="left">Witaj <b>'.$user_data['user_name'].'</b>!</div>
  3. <div style="float: right;" style="width: 500px;" >
  4. [<a href="index.php?parent=strona">Wyświetl swój profil</a>]
  5. [<a href="index.php?parent=edycja">Edytuj profil</a>] [<a href="index.php?parent=lista">Lista użytkowników</a>]
  6. [<a href="logout.php">Wyloguj się</a>]
  7. </div>';
  8. db_close();
  9.  
  10. }


pokaz.php
  1.  
  2. include_once 'config.php';
  3. db_connect();
  4.  
  5. check_login();
  6. $_GET['id'] = (int)clear($_GET['id']);
  7. $user_data = get_user_data($_GET['id']);
  8.  
  9. if($user_data === false) {
  10. echo '<p>Niestety, taki użytkownik nie istnieje.</p>
  11. <p>[<a href="index.php">Powrót</a>]</p>';
  12. } else {
  13. echo '<h2>Profil użytkownika</h2>
  14. <p>Nick: <b>'.$user_data['user_name'].'</b></p>
  15. <p>Email: '.$user_data['user_email'].'</p>
  16. <p>Data rejestracji: '.date("d.m.Y, H:i", $user_data['user_regdate']).'</p>
  17. <p>Strona WWW: '.(empty($user_data['user_website']) ? 'brak' : $user_data['user_website']).'</p>
  18. <p>Skąd: '.(empty($user_data['user_from']) ? 'brak' : $user_data['user_from']).'</p>';
  19. db_close();


Ten post edytował djtomaszq 14.07.2015, 13:17:21
Go to the top of the page
+Quote Post

Posty w temacie


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: 15.10.2025 - 12:31