Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Jak zrobić podkreślenie oglądanego linku?
harbii
post
Post #1





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


Witam!
Chciałbym zrobić coś takiego:
Mamy:

Link1 * Link2 * Link3 * Link4

Chciałbym aby po kliknieciu np Link2 (otwiera się stronka) i linki wyglądają tak:

Link1 * Link2 * Link3 * Link4

Jeżeli wybiore sobie np link4 to mamy:

Link1 * Link2 * Link3 * Link4


Czyli jak zrobić aby w "menu" z linkami był podreślany link z którego aktualnie oglądana jest stronka?
Oczywiście po przejściu na inny link podkreślony jest tylko ten na który prześliśmy (tak jak w przykładzie).

Ten post edytował harbii 17.10.2006, 17:40:44
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
harbii
post
Post #2





Grupa: Zarejestrowani
Postów: 311
Pomógł: 1
Dołączył: 27.05.2006

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


po testach i małych przeróbkach działa sposób @siemakuba
ALE
nie działa jeżeli wszystko wrzucam przez index.php.

Czyli jeżeli napisze to tak:

start.php
  1. <LINK rel="stylesheet" href="tlo.css" type="text/css">
  2. <?php
  3. $page = 'strona1';
  4. ?>
  5. <?php
  6. echo '<a href="start.php" class="'.($page == 'strona1' ? 'current' : 'normal').'">start<br></a>';[php]
  7. echo '<a href="strona2.php" class="'.($page == 'strona2' ? 'current' : 'normal').'">Link 2<br></a>';
  8. echo '<a href="kontakt.php" class="'.($page == 'strona3' ? 'current' : 'normal').'">Link 3<br> </a>';
  9. ?>
  10.  
  11. START


strona2.php
  1. <LINK rel="stylesheet" href="tlo.css" type="text/css">
  2. <?php
  3. $page = 'strona2';
  4. ?>
  5. <?php
  6. echo '<a href="start.php" class="'.($page == 'strona1' ? 'current' : 'normal').'">start<br></a>';
  7. echo '<a href="strona2.php" class="'.($page == 'strona2' ? 'current' : 'normal').'">Link 2<br></a>';
  8. echo '<a href="kontakt.php" class="'.($page == 'strona3' ? 'current' : 'normal').'">Link 3<br> </a>';
  9. ?>
  10.  
  11. STRONA2


kontakt.php
  1. <LINK rel="stylesheet" href="tlo.css" type="text/css">
  2. <?php
  3. $page = 'strona3';
  4. ?>
  5. <?php
  6. echo '<a href="start.php" class="'.($page == 'strona1' ? 'current' : 'normal').'">start<br></a>';
  7. echo '<a href="strona2.php" class="'.($page == 'strona2' ? 'current' : 'normal').'">Link 2<br></a>';
  8. echo '<a href="kontakt.php" class="'.($page == 'strona3' ? 'current' : 'normal').'">Link 3<br> </a>';
  9. ?>
  10.  
  11. KONTAKT


tlo.css
  1. BODY { background-color:#000000; font-size:10; color:#CCCCCC; font-family:Arial, Helvetica, sans-serif}
  2. A{color: ffffff; text-decoration:inherit; text-decoration: none; font-size:12; font-family:Arial, Helvetica, sans-serif}
  3. A:hover{color: #ffffff; font-size:12; text-decoration:underline; font-family:Arial, Helvetica, sans-serif}
  4. table { background-color:#000000; font-size:13; color:#CCCCCC; font-family:Arial, Helvetica, sans-serif}
  5. A.current {
  6. text-decoration:underline;
  7. }


TO DZIAŁA!!! (IMG:http://forum.php.pl/style_emoticons/default/aarambo.gif)

ale nie o to chodzi (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) nie poto robie tą stronke w php aby każdą osobno pisać

Ja bym chciał ayby działało to tak:

tlo.css
  1. BODY { background-color:#000000; font-size:10; color:#CCCCCC; font-family:Arial, Helvetica, sans-serif}
  2. A{color: ffffff; text-decoration:inherit; text-decoration: none; font-size:12; font-family:Arial, Helvetica, sans-serif}
  3. A:hover{color: #ffffff; font-size:12; text-decoration:underline; font-family:Arial, Helvetica, sans-serif}
  4. table { background-color:#000000; font-size:13; color:#CCCCCC; font-family:Arial, Helvetica, sans-serif}
  5. A.current {
  6. text-decoration:underline;
  7. }


menu.php
  1. <?php
  2. echo '<a href="index.php?srodek=start.php" class="'.($page == 'strona1' ? 'current' : 'normal').'">start<br></a>';
  3. echo '<a href="index.php?srodek=strona2.php" class="'.($page == 'strona2' ? 'current' : 'normal').'">Link 2<br></a>';
  4. echo '<a href="index.php?srodek=kontakt.php" class="'.($page == 'strona3' ? 'current' : 'normal').'">Link 3<br> </a>';
  5. ?>




start.php
  1. <?php
  2. $page = 'strona1';
  3. ?>
  4.  
  5.  
  6. START


kontakt.php
  1. <?php
  2. $page = 'strona3';
  3. ?>
  4.  
  5.  
  6. KONTAKT


strona2.php
  1. <?php
  2. $page = 'strona2';
  3. ?>
  4.  
  5.  
  6. STRONA2


A WSZYSTKO IDZIE PRZEZ INDEX.php

index.php
  1. <LINK rel="stylesheet" href="tlo.css" type="text/css">
  2.  
  3. <?php
  4. include ('menu.php')
  5. ?><br />
  6. <br />
  7. <?php
  8.  
  9.  
  10. if (isset($_GET['srodek']))
  11. {
  12. $srodek=$_GET['srodek'];
  13. include("./$srodek");
  14. }
  15. else
  16. { 
  17. include('./start.php');
  18. }
  19.  
  20. ?>



A w ten sposób nie działa (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Myśl @siemakuba jest dobra ale teraz pomóżcie w przerobieniu to aby działoło to przez includy w index.php

(IMG:http://forum.php.pl/style_emoticons/default/blink.gif)
Go to the top of the page
+Quote Post

Posty w temacie
- harbii   [php] Jak zrobić podkreślenie oglądanego linku?   12.10.2006, 20:19:20
- - batman   http://www.w3schools.com/css/css_pseudo_classes.as...   12.10.2006, 20:28:31
- - siemakuba   Nie, nie chodzi tu o pseudoklasy hover, active itp...   13.10.2006, 18:02:42
- - Lee   Koda.active { text-decoration: underline; } n...   13.10.2006, 19:04:12
- - batman   CytatMusisz jakoś wiedzieć na której jes...   13.10.2006, 20:15:06
- - harbii   hmmm zaden pomysł nie działa @siemakuba - może twó...   13.10.2006, 22:46:54
- - siemakuba   @harbii: możesz pokazać troszkę więcej (jakikolwie...   14.10.2006, 08:51:46
- - batman   Cytatmasz rację, jest tablica $_SERVER, ale w...   14.10.2006, 09:07:35
- - phpion.com   a:active zadziala ale tylko w ramkach. Przy przela...   14.10.2006, 09:13:48
- - s_w_ir   To co podam poniżej działa dzięki temu że body każ...   14.10.2006, 11:26:50
- - harbii   po testach i małych przeróbkach działa sposób @sie...   14.10.2006, 12:16:19
- - siemakuba   Bo, skoro robisz to tak, to wszystko jets proste. ...   14.10.2006, 12:29:38
- - harbii   wywala teraz Notice: Undefined index: srodek in d...   14.10.2006, 12:37:46
- - phpion.com   Moze sprobuj przetestowac to, co ja napisalem? Moj...   14.10.2006, 12:54:40
- - siemakuba   O ranny rany... kurcze, trzeba jeszcze by sprawdzi...   14.10.2006, 13:50:34
- - harbii   @siemakuba coś to nie działa , w drugiej linie jes...   15.10.2006, 11:05:49
- - siemakuba   @harbii: osłabiasz mnie... gdybyś troch...   15.10.2006, 12:36:53
- - harbii   jakbym się tak dobrze znał na php to bym...   16.10.2006, 10:19:55
- - lopik   Do skryptu: phpion.com Jeśli dobrze to rozumiem, ...   16.10.2006, 11:16:06
- - harbii   no ok. ale gdzie wpisać linki? bo jak skopiuj...   16.10.2006, 11:23:02
- - lopik   Wpisujesz tylko w tablice. A pęta już re...   16.10.2006, 15:22:25
- - harbii   [PHP] pobierz, plaintext <style>.aktywny {fo...   7.11.2006, 20:16:00


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: 28.12.2025 - 16:50