Jump to content
GSForum - Segélyvonal

Recommended Posts

Posted (edited)

index.php tartalma:

 

    <ul id="menu">
        <li class="active"><a href="index.php?id=home">Home</a></li>
        <li><a href="index.php?id=tagok">Tagok</a></li>
        <li><a href="index.php?id=programok">Programok</a></li>
        <li><a href="index.php?id=contact">Elerhetosegek</a></li>
    </ul>

...

<?php
...
?>

Azt hogy lehetne, hogy ha más menüpontot választok, az legyen a 'class="active" '? Köszi a segítséget!

rita

Edited by ProFiler
Posted

Ha már úgyis php-t használsz, az oldal kiírásakor leellenőrzöd, hogy melyik az aktuális menüpont. Nekem ez generálja a menüt:

 

<?php
  $MenuItems = array("index.php?page=main" => "Főoldal",
                       "index.php?page=news" => "Klánhírek",
                     "index.php?page=members" => "Klántagok",
    //                 "/forum/" => "Fórum",
                     "index.php?page=joining" => "Tagfelvétel",
                     "index.php?page=rules" => "Szabályok",
                     "index.php?page=war" => "War",
                     "index.php?page=downloads" => "Letöltések",
                     "index.php?page=screenshots" => "Screenshotok");
?>
<table width="100%">
<tr>
<?php
  function SetLinkType($S) {
    if (strpos($S, "index.php?page=") !== false) {
      return "_self";
    }
      else
    {
      return "_blank";
    }
  }
  
  function SetClassByPage($S) {
    if (strtolower(substr($S,15)) == $_GET['page']) { return 'menuitem_actual';    } else { return 'menuitem';    }
  }
  
  foreach($MenuItems as $link => $cim) {
/*    echo  '<td width="11%">
  <div class="menuitem"><a href="'.$link.'" target="'.SetLinkType($link).'">'.$cim.'</a></div></td>'; */
    echo  '<td width="11%">
  <div class="'.SetClassByPage($link).'"><a href="'.$link.'" target="_self">'.$cim.'</a></div></td>';
}
?>
</tr></table>

Ezt át lehet alakítani a neked megfelelő formátumra.

Posted (edited)

Köszi, kipróbálom!

---

Működik is, köszi. És tetszik is!

 

rita

 

Szerkeszt gomb és ékezetek!!!

Edited by Spányik Balázs

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...