par
AB » 22 sept. 2007, 19:35
Si tu mets ce code dans chacune de tes pages index.php, download.php, et news.php ça devrait le faire
<?php
function select($selec)
{
if (strpos($_SERVER['REQUEST_URI'],$selec)!==FALSE) echo ' class="select"';
}
?>
<head>
<style type="text/css">
.select a {
font-weight:bold;
color: #0066CC;
}
.menu li {
font-family:Arial, Helvetica, sans-serif;
font-size:1em;
font-weight:normal;
color: #0066CC;
display:inline;
list-style-type:none;
margin:0;
padding:0;
}
.menu a {
text-decoration:none;
}
</style>
</head>
<body>
<ul class="menu">
<li<?php select('index.php')?>><a href="index.php">| Acceuil</a></li>
<li<?php select('download.php')?>><a href="download.php">| Download</a></li>
<li<?php select('news.php')?>><a href="news.php">| News |</a></li>
</ul>
</body>
</html>
EDIT j'ai remplacé id=select par class=select au cas où ce menu serait répété plusieurs fois dans une même page
Si tu mets ce code dans chacune de tes pages index.php, download.php, et news.php ça devrait le faire
[php]<?php
function select($selec)
{
if (strpos($_SERVER['REQUEST_URI'],$selec)!==FALSE) echo ' class="select"';
}
?>
<head>
<style type="text/css">
.select a {
font-weight:bold;
color: #0066CC;
}
.menu li {
font-family:Arial, Helvetica, sans-serif;
font-size:1em;
font-weight:normal;
color: #0066CC;
display:inline;
list-style-type:none;
margin:0;
padding:0;
}
.menu a {
text-decoration:none;
}
</style>
</head>
<body>
<ul class="menu">
<li<?php select('index.php')?>><a href="index.php">| Acceuil</a></li>
<li<?php select('download.php')?>><a href="download.php">| Download</a></li>
<li<?php select('news.php')?>><a href="news.php">| News |</a></li>
</ul>
</body>
</html>[/php]
EDIT j'ai remplacé id=select par class=select au cas où ce menu serait répété plusieurs fois dans une même page