Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> problem z funkcja
adisoft
post 16.09.2004, 20:08:00
Post #1





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 24.01.2004
Skąd: Witten Zentrum <==> Chorzów Batory

Ostrzeżenie: (10%)
X----


witam mam malutka strone oparta na plikach inc i wykorzystujaca

  1. <?php
  2. $HTTP_GET_VARS
  3. ?>


oto kodzik

  1. <?php
  2.  
  3.      $where = $HTTP_GET_VARS['cmd'];
  4.      $allowed_values = array
  5.      
  6.      (
  7.             &#092;"news\" => \"news.inc\",
  8.             &#092;"clan_history\" => \"clan_history.inc\",
  9.             &#092;"clan_members\" => \"clan_members.inc\",
  10.             &#092;"nbkadi\" => \"nbkadi.inc\",
  11.             &#092;"nbkmatus\" => \"nbkmatus.inc\",
  12.             &#092;"nbkmody\" => \"nbkmody.inc\",
  13.             &#092;"nbkfrantz\" => \"nbkfrantz.inc\",
  14.             &#092;"nbkgaret\" => \"nbkgaret.inc\",
  15.             &#092;"nbkiker\" => \"nbkiker.inc\",
  16.             &#092;"clan_matches\" => \"clan_matches.inc\",
  17.             &#092;"clan_awards\" => \"clan_awards.inc\",
  18.             &#092;"sponsoring\" => \"sponsoring.inc\"
  19.             
  20.      );
  21.      
  22.      if ($allowed_values[$where] != '')
  23.      
  24.      {
  25.  
  26.             include(&#092;"main.inc\");
  27.             include(&#092;"$allowed_values[$where]\");
  28.             include(&#092;"stopka.inc\");
  29.             
  30.      }
  31.      
  32.      else
  33.      
  34.      {
  35.      
  36.             include(&#092;"main.inc\");
  37.             include(&#092;"news.inc\");
  38.             include(&#092;"stopka.inc\");
  39.             
  40.      }
  41. ?>

pierwszego pliku czyli index.php ktory wszystko wczytuje mam maly problem albowiem w pozniejszej fazie strony dyrektywa odnosnie linku do jakiegos dzialu wyglada nastepujaco

<a href="index.php?cmd=clan_members" target="_parent">link do clan members</a>

a chcialem zrobic tak aby byla mozliwosc

wejscia do clan members > nastepnie wybor jakis (przykladowo czlonek nbkadi) i klikniecie nbkadi i aby pojawila sie strona nbkadi.inc a link aby byl w takiej formie

<a href="index.php?cmd=clan_members?id=nbkadi" target="_parent">nbkadi</a>

czyli chodzi o ?id=cosik

Jest ktos w stanie mi pomoz co mam jeszcze zmienic w glownym index.php aby dzialalo ?id=jakis_inc sadsmiley02.gif wiecie o co chodzi questionmark.gif moze jestescie jakos w stanie mi pomoc

Ten post edytował adisoft 17.09.2004, 06:45:43


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

-=NaTuRaL BoRn KiLaZz=- Clan
Go to the top of the page
+Quote Post
kszychu
post 17.09.2004, 09:11:44
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 712
Pomógł: 23
Dołączył: 27.10.2003
Skąd: z kontowni

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


Nie tak:
  1. <a href="index.php?cmd=clan_members?id=nbkadi" target="_parent">nbkadi</a>
tylko tak:
  1. <a href="index.php?cmd=clan_members&id=nbkadi" target="_parent">nbkadi</a>


--------------------
"Coś się kończy, coś się zaczyna." Andrzej Sapkowski
Go to the top of the page
+Quote Post
adisoft
post 18.09.2004, 10:31:13
Post #3





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 24.01.2004
Skąd: Witten Zentrum <==> Chorzów Batory

Ostrzeżenie: (10%)
X----


hmmm

  1. <?php
  2.  
  3. http://localhost/nbkclan/index.php?cmd=clan_members&id=nbkadi
  4.  
  5. ?>


nie dziala nie wyswietla strony nbkadi

czyli nbkadi.inc

a nie powinno byc cos dodane jakas funkcja w glownym pliku index.php ktory jest opisany wyzej blink.gif


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

-=NaTuRaL BoRn KiLaZz=- Clan
Go to the top of the page
+Quote Post
cim
post 18.09.2004, 11:29:19
Post #4





Grupa: Zarejestrowani
Postów: 208
Pomógł: 28
Dołączył: 9.08.2004
Skąd: Stargard

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


  1. <?php
  2.  
  3. $where = $HTTP_GET_VARS['cmd'];
  4. $where2 = $HTTP_GET_VARS['id'];
  5.  $allowed_values = array
  6.  
  7.  (
  8. &#092;"news\" => \"news.inc\",
  9. &#092;"clan_history\" => \"clan_history.inc\",
  10. &#092;"clan_members\" => \"clan_members.inc\",
  11. &#092;"nbkadi\" => \"nbkadi.inc\",
  12. &#092;"nbkmatus\" => \"nbkmatus.inc\",
  13. &#092;"nbkmody\" => \"nbkmody.inc\",
  14. &#092;"nbkfrantz\" => \"nbkfrantz.inc\",
  15. &#092;"nbkgaret\" => \"nbkgaret.inc\",
  16. &#092;"nbkiker\" => \"nbkiker.inc\",
  17. &#092;"clan_matches\" => \"clan_matches.inc\",
  18. &#092;"clan_awards\" => \"clan_awards.inc\",
  19. &#092;"sponsoring\" => \"sponsoring.inc\"
  20.  
  21.  );
  22.  
  23.  if ($allowed_values[$where] != '')
  24.  
  25.  {
  26.  
  27. include(&#092;"main.inc\");
  28. include(&#092;"$allowed_values[$where]\");
  29. if(!empty($allowed_values[$where2]) include(&#092;"$allowed_values[$where2]\");
  30. include(&#092;"stopka.inc\");
  31.  
  32.  }
  33.  
  34.  else
  35.  
  36.  {
  37.  
  38. include(&#092;"main.inc\");
  39. include(&#092;"news.inc\");
  40. include(&#092;"stopka.inc\");
  41.  
  42.  }
  43.  
  44. ?>


hmm,... taki kod wyświetli plik wskazany przez 'id' (o ile będzie wskazany) pod plikiem wskazanym przez 'cmd' - o to chodziło? bo nie bardzo rozumiem...


--------------------
errare humanum est
Go to the top of the page
+Quote Post
adisoft
post 18.09.2004, 12:57:22
Post #5





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 24.01.2004
Skąd: Witten Zentrum <==> Chorzów Batory

Ostrzeżenie: (10%)
X----


nie tez nie dziala

chodzi oto aby

jak ktos wchodzi do dzialu clan_members

czyli

  1. <?php
  2. <a href=&#092;"index.php?cmd=clan_members\" target=\"_parent\">clan members</a>
  3.  
  4. ?>


i jest juz w dziale clan members

i teraz chce kliknac (wybrac) np. jakiegos czlonka np. nbkadi

klika

  1. <?php
  2.  
  3. <a href=&#092;"index.php?cmd=clan_members&id=nbkadi\" target=\"_parent\">nbkadi</a>
  4.  
  5. ?>


i wtedy wyswietla sie dzial nbkadi

chodzi oto wlasnie &id=jakies_kolejna_strona lub ?id=jakas_kolejna_strona

dokladnie chodzi oto aby mozna bylo zastosowac przechodzenie z dzialow do dzialow np

strona 1 index.php?cmd=strona1

sub strona pierwszej czyli np. strona 2

index.php?cmd=strona1&id=strona2

withstupidsmiley.gif spox czyli nie da sie mi pomoc sad.gif

spox thx for nothing ide sie dalej mordowac

Ten post edytował adisoft 22.09.2004, 17:56:37


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

-=NaTuRaL BoRn KiLaZz=- Clan
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: 16.06.2025 - 21:11