Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Nawigacja
rashas
post
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 1
Dołączył: 4.03.2008

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


Witam,mam taki problem,zrobiłem taki mały skrypt na nawigacje strony tu skrypt :
  1. <div id="main">
  2.   <?
  3.   if ($_GET["menu"] == "hom") {
  4.   include("pages/home.php");
  5.   }
  6.   if ($_GET["menu"] == "for") {
  7.   include("pages/forum.php");
  8.   }
  9.   if ($_GET["menu"] == "aut") {
  10.   include("pages/author.php");
  11.   }
  12.   if ($_GET["menu"] == "smap") {
  13.   include("pages/sitemap.php");
  14.   }
  15.   ?>
  16.  </div>



No i na początku gdy wchodzę na stronę mam pusto,dopiero jak klikne na link to wczytuje mi sie strona,a jak zrobić żeby odrazu wczytywało home?

Ten post edytował rashas 20.12.2008, 08:34:24
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
rashas
post
Post #2





Grupa: Zarejestrowani
Postów: 19
Pomógł: 1
Dołączył: 4.03.2008

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


nie działa mi :< w ogole nie wczytuje zadnej strony prócz hom teraz :<

///EDIT

Działa ;

trzeba było zamiast :
Kod
if(isset($_GET['menu'])) $_GET['menu'] = 'hom';

to
Kod
if(!isset($_GET['menu'])) $_GET['menu'] = 'hom';


(dodać '!' do 'isset ' ;])

Ten post edytował rashas 20.12.2008, 08:29:52
Go to the top of the page
+Quote Post
pyro
post
Post #3





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

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


Cytat(rashas @ 15.12.2008, 20:16:02 ) *
nie działa mi :< w ogole nie wczytuje zadnej strony prócz hom teraz :<

Kod
<?

if(isset($_GET['menu'])) $_GET['menu']='hom';

if ($_GET["menu"] == "hom") {
include("pages/home.php");
}
if ($_GET["menu"] == "for") {
include("pages/forum.php");
}
if ($_GET["menu"] == "aut") {
include("pages/author.php");
}
if ($_GET["menu"] == "smap") {
include("pages/sitemap.php");
}
?>


tak powinno wyglądać?


nie, przyjrzyj sie pierwszej linijce i wczytaj...

poprawinej:

  1. <?php
  2. // tylko se dokoncz
  3.  
  4. switch($_GET['bla'])
  5. {
  6. case 'smap':
  7. include 'smap.php';
  8. break;
  9. case 'cnl':
  10. include 'cnl.php';
  11. break;
  12. default:
  13. include 'default.php'; // gdy nieustawiona zmienna lub ktoras ktorej nie ma powyzej to zaincluduje wlasnie te strone
  14. }
  15. ?>
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: 14.10.2025 - 03:31