2013-06-21 99 views
0

我一直在尋找很多方法可以使標籤活躍在使用PHP包括功能添加導航欄到每個網頁上的點擊和使用PHP做鏈接積極的,如果點擊所以這裏我有錯誤或問題是它顯示「和一個」之前的單詞家或任何其他選項卡 所以這裏是代碼...主導航欄PHP文件...這是包含在使用PHP包括功能的HTML :PHP類=「活動」錯誤與導航欄

<body> 


<!--Nav Bar--> 
      <?php 

       function echoActiveClassIfRequestMatches($requestUri) 
       { 
        $current_file_name = basename($_SERVER['REQUEST_URI'], ".php"); 

        if ($current_file_name == $requestUri) 
         echo 'class="active"'; 
       } 

      ?> 
<div class="navbar navbar-inverse navbar-fixed-top"> 
    <div class="navbar-inner"> 
      <div class="container" >    
        <ul class="nav"> 

         <a class="brand" class="divider-vertical" href="#"> The Aerosquadron</a>           
         <li <?=echoActiveClassIfRequestMatches("index")?>><a href="index.php">">Home</a></li>            
         <li <?=echoActiveClassIfRequestMatches("Robots_page")?>><a href="Robots_page.php">">Robots</a></li>          
         <li <?=echoActiveClassIfRequestMatches("Sponsors_page")?>><a href="Sponsors_page.php">">Our Sponsors</a></li>  
         <li <?=echoActiveClassIfRequestMatches("History")?>><a href="History.php">The History</a></li>           
         <li <?=echoActiveClassIfRequestMatches("About_first")?>><a href="About_first.php">">About FIRST</a></li> 

        </ul> 
       </div> 
      </div> 
    </div>   
+0

嘗試將所有的<=標籤更改爲正常? – Bananam00n

回答

0

最終的HTML部分:??

<div class="navbar navbar-inverse navbar-fixed-top"> 
    <div class="navbar-inner"> 
      <div class="container" > 
        <ul class="nav"> 

         <a class="brand" class="divider-vertical" href="#"> The Aerosquadron</a> 
         <li <?=echoActiveClassIfRequestMatches("index")?>><a href="index.php">Home</a></li>           
         <li <?=echoActiveClassIfRequestMatches("Robots_page")?>><a href="Robots_page.php">Robots</a></li>        
         <li <?=echoActiveClassIfRequestMatches("Sponsors_page")?>><a href="Sponsors_page.php">Our Sponsors</a></li>  
         <li <?=echoActiveClassIfRequestMatches("History")?>><a href="History.php">The History</a></li>         
         <li <?=echoActiveClassIfRequestMatches("About_first")?>><a href="About_first.php">About FIRST</a></li> 

        </ul> 
       </div> 
      </div> 
    </div> 
+0

行,所以我擺脫了「的,現在的>標誌還有什麼想法 – user2288958

+0

在我的本地主機,沒有>標誌你確定它的仍然存在? – foxns7

+0

我修復了這個問題,現在的問題是它不會被激活 – user2288958