Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> dynamiczne linki
kudlaty90
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 13.03.2006

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


witam jestem poczatkowym tworca stron i mam do was prosbe moze mi ktos pokolei wytlumaczyc jak zrobic dynamiczne linki (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) !!Chcialbym zeby adres mojej strony wygladal mneij wiecej tak

http://www.localhost.pl/index.php?page=text
http://www.localhost.pl/index.php?page=text&id=2

Probowalem sam do tego dojsc i jakos nie moge tego rozgrysc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował kudlaty90 15.03.2006, 18:04:29
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
LBO
post
Post #2





Grupa: Zarejestrowani
Postów: 1 415
Pomógł: 117
Dołączył: 7.09.2005
Skąd: Warszawa

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


sam tworzysz takie linki, wklepujesz je osobiscie (ale jak znasz strukture url, to nie ma problemu by skrypt zrobil to za ciebie)... dane przeslane w url (zmienne) uzywasz potem w skrypcie, pobierajac je z tablicy $_GET. dla twoich linkow to bedzie:
  1. <?php
  2.  
  3. echo $_GET['page']; // text
  4. echo $_GET['id']; // 2
  5.  
  6. ?>
Go to the top of the page
+Quote Post
kudlaty90
post
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 13.03.2006

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


mam prosbe mozesz zrobic mi przykladowe pliki i wyslac na mejla to mi latwiej bedzie zrozumiec (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
pawelgdz
post
Post #4





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 30.01.2006

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


masz plik index.php ...


  1. <table border=0>
  2.  
  3. <tr>
  4. <td>
  5. Menu : <a href=?url=omnie>O mnie</a> | <a href=?url=kontakt>Kontakt</a>
  6. </td>
  7. </tr>
  8.  
  9. <tr>
  10. <td>
  11.  
  12. <!--Geshi:34086:php--><pre class="php-brief" style="font-family:monospace;"><div class="head">[PHP] <a href='./Pobierz-Plik-34086.html'>pobierz</a>, <a href='Plaintext-34086.html'>plaintext</a> </div><ol><li class="li1"><div class="de1"><span class="kw2"><?php</span></div></li><li class="li2"><div class="de2"> </div></li><li class="li1"><div class="de1"> <span class="kw1">switch</span><span class="br0">(</span><span class="st0">"$_GET[url]"</span><span class="br0">)</span> <span class="br0">{</span></div></li><li class="li2"><div class="de2"> </div></li><li class="li1"><div class="de1"> <span class="kw1">case</span> <span class="st0">"omnie"</span><span class="sy0">:</span> tutaj_ładujesz_strone_o_mnie<span class="sy0">;</span> <span class="kw1">break</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2"> <span class="kw1">case</span> <span class="st0">"kontakt"</span><span class="sy0">:</span> tutaj_ładujesz_strone_kontakt<span class="sy0">;</span> <span class="kw1">break</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"> </div></li><li class="li2"><div class="de2"> <span class="kw2">default</span><span class="sy0">:</span> ładujesz_domyslnie_index<span class="sy0">;</span> <span class="kw1">break</span></div></li><li class="li1"><div class="de1"> </div></li><li class="li2"><div class="de2"> </div></li><li class="li1"><div class="de1"> <span class="br0">}</span></div></li><li class="li2"><div class="de2"> </div></li><li class="li1"><div class="de1"><span class="sy1">?></span></div></li></ol><div class="foot">[PHP] <a href='./Pobierz-Plik-34086.html'>pobierz</a>, <a href='Plaintext-34086.html'>plaintext</a> </div></pre><!--/Geshi:34086:php-->
  13. </td>
  14. </tr>


cała filozofia ... tam gdzie ładujesz strony mozesz miec osobne pliczki ze stronami np. omnie.php i kontakt.php i ładować je za pomoca
  1. <?php
  2.  
  3.  
  4.  
  5.  
  6. switch("$_GET[url]") {
  7.  
  8. case "omnie": include 'omnie.php'; break;
  9. case "kontakt": include 'kontakt.php'; break;
  10.  
  11. default: ładujesz_domyslnie_index; break
  12.  
  13.  
  14.  }
  15.  
  16.  
  17. ?>


to chyba najprostszy przykład na jakim moglem Ci to wytlumaczyć
Go to the top of the page
+Quote Post
kudlaty90
post
Post #5





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 13.03.2006

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


Cytat
Parse error: parse error, unexpected '}' in /home/dh58/public_html/test/index.php on line 23


kurde cos ostatnio nic mi nie idzie (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
chomiczek
post
Post #6





Grupa: Zarejestrowani
Postów: 271
Pomógł: 4
Dołączył: 5.01.2005

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


Hmmm.. chyba widzę problem:
a może sie myle:
  1. <?php
  2. switch("$_GET[url]") {
  3. case "omnie": include 'omnie.php'; break;
  4. case "kontakt": include 'kontakt.php'; break;
  5. default: ładujesz_domyslnie_index; break[B];[/B]
  6. }
  7. ?>

chyba brakowało ; po ostatnim break.
Go to the top of the page
+Quote Post
kudlaty90
post
Post #7





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 13.03.2006

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


dzieki chomiczek juz zaczailem (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
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: 22.08.2025 - 15:27