Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> dynamiczne menu z podswietleniem aktualnej strony, jak wyonac? :(
hexen
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 15.03.2006

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


Witam

chcialbym zrobic dynamiczne menu, w którym wygląd guzika dla aktualnej podstrony jest wyróżniony...

tak jak tutaj: http://www.kdemod.ath.cx/

probowalem tego:
Kod
<?
$dzial = $_GET["dzial"];
$menu[0]=array("menu1.gif", "menu1w.gif", "Początek");
$menu[1]=array("menu0.gif", "menu0w.gif", "Strony WWW");
$menu[2]=array("menu2.gif", "menu2w.gif", "O nas");
$menu[3]=array("menu3.gif", "menu3w.gif", "Oferta");

echo '
<script type="text/javascript">
<!-- <![CDATA[
';

foreach($menu as $klucz=>$wartosc) {
  if ($klucz==$dzial) {
    echo 'new Image().src="'.$menu[$klucz][0].'";'."\n";
    $menu[$klucz]="<img src=\"{$menu[$klucz][1]}\" border=\"0\"
    alt=\"{$menu[$klucz][2]}\" />";
  } else {
    echo 'new Image().src="'.$menu[$klucz][1].'";'."\n";
    $menu[$klucz]="<img src=\"{$menu[$klucz][0]}\" border=\"0\"
    alt=\"{$menu[$klucz][2]}\" onmouseover=\"this.src='{$menu[$klucz][1]}'\"
    onmouseout=\"this.src='{$menu[$klucz][0]}'\" />";
  }
}

echo '
// ]]> -->
</script>
';
?>

<a href="index.php?dzial=0"><?=$menu[0]?></a>
<a href="index.php?dzial=1"><?=$menu[1]?></a>
<a href="index.php?dzial=2"><?=$menu[2]?></a>
<a href="index.php?dzial=3"><?=$menu[3]?></a>


ale jednak nie o to mi chodzilo... chodzi mi o dokladnie identyczne menu jak jest na tamtej stronie, zeby funkcjonowalo tak samo, a jedynym elementem graficznym w tym menu zeby bylo tlo aktaulnie odwiedzanej strony i nic wiecej z grafiki smile.gif

chcialbym zrobic cos takiego ale szukam jzu 3 dzien i nigdzie nie moge sie doszukac... zaplacilem nawet 10zl za sms'a na algorytmy.pl zeby to podpatrzec, ale i tam nie znalazlem tego co chcialem...

pomoze mi ktos? bylbym wdzieczny
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
wipo
post
Post #2





Grupa: Zarejestrowani
Postów: 856
Pomógł: 19
Dołączył: 30.08.2005
Skąd: 100lica

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


O CSS sobie poczytaj
Kod
a{
font-family: Arial;
font-size: 12px;
background-color: #F00000;
color: black;
}
a:hover{
font-family: Arial;
font-size: 12px;
background-color: #F0F000;
color: black;
}


to taki przykład


--------------------
Go to the top of the page
+Quote Post
hexen
post
Post #3





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 15.03.2006

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


raczej nie o to mi chodzilo... chodzi mi o to aby strona ktora wlasnie ogladam w menu byla odznaczona, jak na przykladzie ktory podalem w poprzedniej stronie... tam zaznaczenie objawia sie poprzez umieszczenie pod menu obrazka... tak chcialbym aby bylo u mnie...
Go to the top of the page
+Quote Post
wipo
post
Post #4





Grupa: Zarejestrowani
Postów: 856
Pomógł: 19
Dołączył: 30.08.2005
Skąd: 100lica

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


robisz 2 klasy
a.top{
dsdsds
}
a.top:hover{
fdfd
}
a.top2{
}
a.top2:hover{
}

<a href="index.php?dzial=0" class="top<? if ($_GET['dzial']==0) print "2";?>><?=$menu[0]?></a>
<a href="index.php?dzial=1" class="top<? if ($_GET['dzial']==0) print "2";?>><?=$menu[1]?></a>
<a href="index.php?dzial=2" class="top<? if ($_GET['dzial']==0) print "2";?>><?=$menu[2]?></a>
<a href="index.php?dzial=3" class="top<? if ($_GET['dzial']==0) print "2";?>><?=$menu[3]?></a>


--------------------
Go to the top of the page
+Quote Post
hexen
post
Post #5





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 15.03.2006

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


oto moj fragment css dot menu:
Kod
ul, ol
{
    margin:1em;
    padding:0;
}
li
{
    margin:0 1em;
    padding:0.15em;

Kod
#menu
{
position: relative;
background: #2164b6 url(../images/menubg.gif) repeat-x top left;
height: 3.5em;
padding: 0 1.0em;
margin: 0 0 2px;
}

#menu ul
{
padding:1em 0 0 0;
margin:0;
}

#menu ul li
{
position: relative;
display: inline;
padding:0;
margin:0;
}

#menu ul li a:link, #menu ul li a:visited
{
    color: #fff;
    padding: 0.5em 1.0em 0.9em 1.0em;
    text-decoration: none;    
    border:none;
}

#menu ul li a:hover,
#menu ul li a:active,
#menu ul li.current_page_item a
{
    background: #7F8400 url(../images/menuactive.gif) repeat-x top left;
    border:none;
}


a oto menu:

  1. <ul>
  2. <li class="first current_page_item"><a href="?go=start">Home</a></li>
  3. <li class="page_item"><a href="?go=cennik">Cennik</a></li>
  4. <li class="page_item"><a href="?go=portfolio">Portfolio</a></li>
  5. <li class="page_item"><a href="?go=kontakt">Kontakt</a></li>
  6. </ul>


i mimo to nie dziala tak jakbym chcial sad.gif

Ten post edytował hexen 12.12.2006, 18:23:38
Go to the top of the page
+Quote Post
wipo
post
Post #6





Grupa: Zarejestrowani
Postów: 856
Pomógł: 19
Dołączył: 30.08.2005
Skąd: 100lica

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


popatrz na klase tą co wyżej wysłałem a i a:hover


--------------------
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 Aktualny czas: 21.08.2025 - 06:07