添加活动 class 和 php 后链接无法正常工作
Links are not fully working after adding active class with php
我正在使用 php 将活动 link 状态添加到我的导航菜单中,该菜单在我的所有网站页面上动态共享。但是当我从主页转到其他 links 时它工作正常但是当我返回主页时它给我 "object not found" 错误。
<!--start vertical menu-->
<?php
$index="menu-items";
$top_albums_default="menu-items";
$Topartists="menu-items";
$Toplists="menu-items";
$Charts="menu-items";
$menuLinkid=basename($_SERVER['PHP_SELF'],".php");
if($menuLinkid=="index"){
$index='active';
}else if ($menuLinkid=="top_albums_default"){
$top_albums_default='active';
}else if ($menuLinkid=="Topartists"){
$Topartists='active';
}else if ($menuLinkid=="Toplists"){
$Toplists='active';
}else if ($menuLinkid=="Charts"){
$Charts='active';
}
?>
<div id="vertical-menu">
<!--<h2 class="logo">LOGO</h2>-->
<img class="logo" src="../Graphics/icons/logo.png" alt="LOGO"/>
<h6 class="logo-desc">Arcade Music Repository</h6>
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>
<li>
<a class="<?php echo $top_albums_default; ?>" href="Top-albums/top_albums_default.php"><i class="arcd-music97"></i></br>Top albums</a>
</li>
<li>
<a href="../Top-artists/top-artists_default.php"><i class="arcd-microphone52"></i></br>Top artists</a>
</li>
<li>
<a href="../Top-lists/top-lists_default.php"><i class="arcd-numbered8"></i></br>Top lists</a>
</li>
<li>
<a href="../Charts/Charts_default.php"><i class="arcd-rising9"></i></br>Charts</a>
</li>
</ul>
</div>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"> </script>
您的主页上缺少正斜杠 link。
像这样:
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="/index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>
我正在使用 php 将活动 link 状态添加到我的导航菜单中,该菜单在我的所有网站页面上动态共享。但是当我从主页转到其他 links 时它工作正常但是当我返回主页时它给我 "object not found" 错误。
<!--start vertical menu-->
<?php
$index="menu-items";
$top_albums_default="menu-items";
$Topartists="menu-items";
$Toplists="menu-items";
$Charts="menu-items";
$menuLinkid=basename($_SERVER['PHP_SELF'],".php");
if($menuLinkid=="index"){
$index='active';
}else if ($menuLinkid=="top_albums_default"){
$top_albums_default='active';
}else if ($menuLinkid=="Topartists"){
$Topartists='active';
}else if ($menuLinkid=="Toplists"){
$Toplists='active';
}else if ($menuLinkid=="Charts"){
$Charts='active';
}
?>
<div id="vertical-menu">
<!--<h2 class="logo">LOGO</h2>-->
<img class="logo" src="../Graphics/icons/logo.png" alt="LOGO"/>
<h6 class="logo-desc">Arcade Music Repository</h6>
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>
<li>
<a class="<?php echo $top_albums_default; ?>" href="Top-albums/top_albums_default.php"><i class="arcd-music97"></i></br>Top albums</a>
</li>
<li>
<a href="../Top-artists/top-artists_default.php"><i class="arcd-microphone52"></i></br>Top artists</a>
</li>
<li>
<a href="../Top-lists/top-lists_default.php"><i class="arcd-numbered8"></i></br>Top lists</a>
</li>
<li>
<a href="../Charts/Charts_default.php"><i class="arcd-rising9"></i></br>Charts</a>
</li>
</ul>
</div>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"> </script>
您的主页上缺少正斜杠 link。
像这样:
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="/index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>