Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Wycztanie index.php?id=news
Bladeq123
post 12.01.2009, 17:01:00
Post #1





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


Witam dalej mam ten problem, otóż:

Chce zeby jak wejde na stronę lala.pl, zeby mi czytało lala.pl/index.php?id=news, a nie lala.pl/index.php

Jak to zrobić kiedyś mi jeden user podał żeby wkleił to w head: <?php
header("Location: index.php?id=news");
?>

ale to nie działa.

Proszę o pomoc.
Go to the top of the page
+Quote Post
erix
post 12.01.2009, 17:04:48
Post #2





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Nie działa, to znaczy? Wypluwa klasyczny błąd, którego rozwiązanie można znaleźć wpisując jego treść do wyszukiwarki?


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
Bladeq123
post 12.01.2009, 17:18:06
Post #3





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


moglbys pomoc a nie robic z siebie nie wiadomo kogo.
Go to the top of the page
+Quote Post
WebKing
post 12.01.2009, 17:20:43
Post #4





Grupa: Zarejestrowani
Postów: 219
Pomógł: 16
Dołączył: 16.07.2007

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


  1. <?php
  2. if ($_GET["id"] == "news") {
  3.   echo "jakas strona";
  4. }
  5. ?>

Prosze chyba o to chodzi
Go to the top of the page
+Quote Post
Bladeq123
post 12.01.2009, 17:21:47
Post #5





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


ale gdzie to wkleic?
Go to the top of the page
+Quote Post
nugae
post 12.01.2009, 17:40:18
Post #6





Grupa: Zarejestrowani
Postów: 19
Pomógł: 2
Dołączył: 30.03.2004

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


Cytat(Bladeq123 @ 12.01.2009, 19:18:06 ) *
moglbys pomoc a nie robic z siebie nie wiadomo kogo.


łatwiej byłoby Ci pomóc gdybyś dokładnie opisał swój problem a tak można się tylko domyślać o co chodzi.
może

Kod
<?php
if( !isset($_GET['id']) )
$_GET['id'] = 'news';
?>


+ reszta Twojego kodu

Ten post edytował nugae 12.01.2009, 17:41:06
Go to the top of the page
+Quote Post
Bladeq123
post 12.01.2009, 17:43:09
Post #7





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


<?php
if($_GET['id']=="news"){
include("dane/news.html");
}

if($_GET['id']=="programy"){
include("dane/programy.html");
}

if($_GET['id']=="ksiazki"){
include("dane/ksiazki.html");
}


?>

mam cos takiego tam gdzie chce zeby otweiraly sie zakladaki co nie tam gdzie news.

Chodzi mi o to ze jak wejde na strone to ona jest pusta bez newsow, dlatego chce zeby podać mi kod ze jak wejde na strone czytało mi odrazu news, czyli to:

<?php
if($_GET['id']=="galeria"){
include("dane/galeria.html");
}

Ten post edytował Bladeq123 12.01.2009, 17:43:58
Go to the top of the page
+Quote Post
kefirek
post 12.01.2009, 17:45:40
Post #8





Grupa: Zarejestrowani
Postów: 781
Pomógł: 256
Dołączył: 29.06.2008

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


O takie cos chodzi
  1. <?php
  2. if($_GET['id']=="galeria"){
  3. include("dane/galeria.html");
  4. } elseif($_GET['id']=="programy"){
  5. include("dane/programy.html");
  6. }elseif($_GET['id']=="ksiazki"){
  7. include("dane/ksiazki.html");
  8. } else {
  9. include("dane/galeria.html");
  10. }
  11. ?>


Ten post edytował kefirek 12.01.2009, 17:46:48
Go to the top of the page
+Quote Post
Bladeq123
post 12.01.2009, 17:48:35
Post #9





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


No ale kefirek, nie bedzie mi czytało index.php?id=news, ty mi podałes to co ja teraz mam a strona nadal bedzie pusta w index.php
Go to the top of the page
+Quote Post
kefirek
post 12.01.2009, 17:52:36
Post #10





Grupa: Zarejestrowani
Postów: 781
Pomógł: 256
Dołączył: 29.06.2008

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


No jak może być pósta skoro na końcu masz
  1. <?php
  2. } else {
  3. include("dane/galeria.html");
  4. }
  5. ?>


Ten post edytował kefirek 12.01.2009, 18:00:12
Go to the top of the page
+Quote Post
Bladeq123
post 12.01.2009, 17:56:03
Post #11





Grupa: Zarejestrowani
Postów: 17
Pomógł: 0
Dołączył: 25.12.2008

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


Dzieki chlopie masz + :*
Go to the top of the page
+Quote Post
Snap
post 14.01.2009, 00:02:22
Post #12





Grupa: Zarejestrowani
Postów: 75
Pomógł: 4
Dołączył: 29.05.2005

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


A ja bym to zrobił za pomocą funkcji switch" title="Zobacz w manualu PHP" target="_manual.

  1. <?php
  2. switch ($_GET['id']) {
  3.    
  4.    case "galeria":
  5.        include("dane/galeria.html");
  6.    break;
  7.    
  8.    case "programy":
  9.        include("dane/programy.html");
  10.    break;
  11.    
  12.    case "ksiazki":
  13.        include("dane/ksiazki.html");
  14.    break;
  15.    
  16.    default:
  17.        include("dane/galeria.html");
  18.    break;    
  19.  
  20. }
  21. ?>


Prawda że ładnie i czytelnie smile.gif

Ten post edytował Snap 14.01.2009, 00:04:07
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: 13.06.2025 - 03:52