Results 1 to 7 of 7

Thread: Same navbar on multiple pages.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2020
    Posts
    59

    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
    6,073

    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.
    .

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

    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?
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  4. #4
    New Member
    Join Date
    Sep 2020
    Location
    Daly City
    Posts
    4

    Re: Same navbar on multiple pages.

    I would suggest you to go with Vue.js - a front-end javascript framework. You just need to code once in a component and then you can import then component in other routes. The reason I'm suggesting this is because this won't include a server. It might take an hour or two for set up but this is he best solution.

  5. #5

    Re: Same navbar on multiple pages.

    hello...
    you can just create your navbar HTML shared view and use it on your all page just linking it. you cant need to write the same code again and again.
    < advertising removed by moderator >

  6. #6

    Re: Same navbar on multiple pages.

    same issue here. I expect more.

  7. #7
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,598

    Re: Same navbar on multiple pages.

    Quote Originally Posted by friendpicksd View Post
    same issue here. I expect more.
    Nobody has responded to my original post, #3. How can I provide more without additional details?
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

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