Results 1 to 3 of 3

Thread: Same navbar on multiple pages.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2020
    Posts
    58

    Same navbar on multiple pages.

    I have Index.html , about.html contact.html using bootstrap

    I have created a navbar on Index.html but I want the same navbar on all the pages.

    Do i have to copy the same code on every page or is there any other procedure.

    Please suggest!!

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,650

    Re: Same navbar on multiple pages.

    Hello.
    If you where using asp.net I would have suggested Master Pages.
    In PHP , have a look here , maybe it can help you do the same: http://hoolihan.net/blog-tim/2008/09...ages-with-php/
    And bootstrap: https://bootstrapstudio.io/forums/topic/master-page/
    Last edited by sapator; Sep 23rd, 2020 at 06:26 AM.
    Slow as hell.

  3. #3
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,721

    Re: Same navbar on multiple pages.

    Essentially what you're referring to often called components, partials, or templates depending on your environment.

    A fairly straightforward solution using jQuery would be to define the properties of your navbar and its items in a JSON file. You'd then use AJAX to read the JSON file and convert it to an object. Using the object, you would then build the DOM on the fly using the properties of the object and optionally properties from the current location (like the URL to specify an "active" item).

    Could you elaborate on the technologies that you're using and what it is that you'd expect?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width