ソースを参照

Fix Projets active in navbar for every project page.

Jovian (Darkside) 6 年 前
コミット
da476d017f
5 ファイル変更21 行追加14 行削除
  1. 18 11
      header.php
  2. 1 1
      index.php
  3. 0 0
      projets.php
  4. 1 1
      projets/pro_quoridor.php
  5. 1 1
      projets/pro_static_site.php

+ 18 - 11
header.php

@@ -14,7 +14,7 @@
     <link href="/css/custom/main.css" rel="stylesheet">
     <link href="/css/custom/pagination.css" rel="stylesheet">
 
-    <title><?php echo $title;?> - Jovian Hersemeule</title>
+    <title><?php echo $title; ?> - Jovian Hersemeule</title>
 </head>
 <body>
 
@@ -27,42 +27,49 @@
          alt="V">
     <div class="collapse navbar-collapse" id="joviaNav">
         <ul class="navbar-nav mr-auto">
-            <li class="nav-item <?php if ($title == "Accueil") echo "active";?>">
+            <li class="nav-item <?php if ($title == "Accueil") echo "active"; ?>">
                 <a class="nav-link" href="/index.php">
                     <img src="https://img.icons8.com/color/48/000000/city.png" alt="|">
                     Accueil
                 </a>
             </li>
-            <li class="nav-item <?php if ($title == "CV") echo "active";?>">
+            <li class="nav-item <?php if ($title == "CV") echo "active"; ?>">
                 <a class="nav-link" href="/cv.php">
                     <img src="https://img.icons8.com/color/48/000000/parse-from-clipboard.png" alt="|">
                     CV
                 </a>
             </li>
-            <li class="nav-item dropdown <?php if ($title == "Projets") echo "active";?>">
-                <a class="nav-link dropdown-toggle" href="/projects.php" id="dropdown01" data-toggle="dropdown"
+            <li class="nav-item dropdown
+            <?php if (substr($_SERVER["SCRIPT_NAME"], 1, 7) == "projets") echo "active"; ?>">
+                <a class="nav-link dropdown-toggle" href="/projets.php" id="dropdown01" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false">
                     <img src="https://img.icons8.com/color/48/000000/code.png" alt="|">
                     Projets
                 </a>
                 <div class="dropdown-menu" aria-labelledby="dropdown01">
-                    <a class="dropdown-item <?php if ($title == "Projets") echo "active";?>" href="/projects.php">Liste des projets</a>
+                    <a class="dropdown-item <?php if ($title == "Projets") echo "active"; ?>" href="/projets.php">
+                        Liste des projets
+                    </a>
                     <div class="dropdown-divider"></div>
-                    <a class="dropdown-item <?php if ($title == "Site") echo "active";?>" href="/projets/pro_static_site.php">
+                    <a class="dropdown-item <?php if ($title == "Site") echo "active"; ?>"
+                       href="/projets/pro_static_site.php">
                         Jovian Website
                     </a>
-                    <a class="dropdown-item <?php if ($title == "ASCII") echo "active";?>" href="/projets/pro_ascii_space.php">
+                    <a class="dropdown-item <?php if ($title == "ASCII") echo "active"; ?>"
+                       href="/projets/pro_ascii_space.php">
                         ASCII Space Destroyer
                     </a>
-                    <a class="dropdown-item <?php if ($title == "Pulsar") echo "active";?>" href="/projets/pro_pulsar.php">
+                    <a class="dropdown-item <?php if ($title == "Pulsar") echo "active"; ?>"
+                       href="/projets/pro_pulsar.php">
                         Pulsar
                     </a>
-                    <a class="dropdown-item <?php if ($title == "Quoridor") echo "active";?>" href="/projets/pro_quoridor.php">
+                    <a class="dropdown-item <?php if ($title == "Quoridor") echo "active"; ?>"
+                       href="/projets/pro_quoridor.php">
                         Quoridor
                     </a>
                 </div>
             </li>
-            <li class="nav-item <?php if ($title == "Contact") echo "active";?>">
+            <li class="nav-item <?php if ($title == "Contact") echo "active"; ?>">
                 <a class="nav-link" href="/contact.php">
                     <img src="https://img.icons8.com/color/48/000000/secured-letter.png" alt="|">
                     Contact

+ 1 - 1
index.php

@@ -19,7 +19,7 @@ include("header.php");
     <!-- Map image parts to site naviagtion -->
     <map class="d-none d-sm-block" name="homemap">
         <area shape="rect" coords="120,12,412,306" alt="CV" href="cv.php">
-        <area shape="rect" coords="494,592,944,880" alt="Projets" href="projects.php">
+        <area shape="rect" coords="494,592,944,880" alt="Projets" href="projets.php">
         <area shape="rect" coords="0,564,194,708" alt="Contact" href="contact.php">
     </map>
 

projects.php → projets.php


+ 1 - 1
projets/pro_quoridor.php

@@ -49,7 +49,7 @@ include("../header.php");
 			<div class="page-link" title="Quoridor">4</div>
 		</li>
 		<li class="page-item">
-			<a class="page-link arrow" title="Page suivante" href="../projects.php">&raquo</a>
+			<a class="page-link arrow" title="Page suivante" href="../projets.php">&raquo</a>
 		</li>
 	</ul>
 </main>

+ 1 - 1
projets/pro_static_site.php

@@ -215,7 +215,7 @@ include("../header.php");
     <!-- Pagination -->
     <ul class="pagination pagination-lg justify-content-center">
         <li class="page-item">
-            <a class="page-link arrow" title="Page précédente" href="../projects.php">&laquo</a>
+            <a class="page-link arrow" title="Page précédente" href="../projets.php">&laquo</a>
         </li>
         <li class="page-item active">
             <div class="page-link" title="Site web de Jovian">1</div>