Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][CSS]a:active ?
Strarus
post
Post #1





Grupa: Zarejestrowani
Postów: 339
Pomógł: 12
Dołączył: 22.11.2008

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


Cześć:)
Chciałbym zrobić menu, które gdy jestem na danej stronie zmienia wygląd. Przykład:

Normalnie menu:

home site1 site2 site3

Gdy jesteśmy na site2:

home site1 site2 site3

Niestety używając a.menu:active nie udało mi się osiągnąć tego efektu, w jaki sposób mogę uzyskać taki efekt?

edit: coś takiego: (IMG:http://img132.imageshack.us/img132/752/adasdsafyc4.jpg) (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował Strarus 4.01.2009, 18:55:49
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Skie
post
Post #2





Grupa: Zarejestrowani
Postów: 555
Pomógł: 84
Dołączył: 20.02.2008
Skąd: Małopolska

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


Aaa... błąd jest w tym co Ci podałem - moja wina, nie sprawdziłem dokładnie co zwraca $_SERVER['REQUEST_URI'], oczywiście tak powinno być:

  1. <?php
  2. $arrpages = array();
  3. $arrpages['index.php'] = 'index';
  4. $arrpages['index.php?site=about'] = 'about';
  5. $arrpages['index.php?site=gallery'] = 'gallery';
  6.  
  7. foreach($arrpages as $key => $value) {
  8.  if ($_SERVER['REQUEST_URI'] == '/'.$key) {
  9.     print('<a class="aktywny" href="'.$key.'">'.$value.'</a>');
  10.  } else {
  11.     print('<a class="normalny" href="'.$key.'">'.$value.'</a>');
  12.  }
  13. }
  14. ?>


lub

  1. <?php
  2. $arrpages = array();
  3. $arrpages['/index.php'] = 'index';
  4. $arrpages['/index.php?site=about'] = 'about';
  5. $arrpages['/index.php?site=gallery'] = 'gallery';
  6.  
  7. foreach($arrpages as $key => $value) {
  8.  if ($_SERVER['REQUEST_URI'] == $key) {
  9.     print('<a class="aktywny" href="'.$key.'">'.$value.'</a>');
  10.  } else {
  11.     print('<a class="normalny" href="'.$key.'">'.$value.'</a>');
  12.  }
  13. }
  14. ?>


... Brakowało "/" (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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 - 02:46