简体   繁体   中英

Make Bootstrap Navbar Adjustment for Included Content Website

I am trying to use bootstrap on php website. The problem is, because I use only index.php and include the specific content for each page, all buttons on the navbar are in the "current page" mode (in other words the nav buttons appear to be depressed), since all pages are actually index.php. The code below illustrates how the pages work:

<?php
                if (isset($_GET['page']))
                {
                    $page = $_GET['page'];
                    require ('Pages/' . $page . '.page.php');
                }
                else
                {
                    $_GET['page'] = "home";
                    include ('Pages/home.page.php');
                }
                ?>

Is there a way to change this functionality so that only the current page (is indicated by the contents of $_GET['page'] is show as the current page on the navbar?

Set the class of the link representing the current page to class="active" . This will make that link show as the current page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM