-
Sep 22nd, 2020, 11:19 PM
#1
Thread Starter
Member
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!!
-
Sep 23rd, 2020, 06:05 AM
#2
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.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Sep 25th, 2020, 11:41 AM
#3
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?
-
Nov 27th, 2020, 08:11 AM
#4
New Member
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.
-
Dec 31st, 2020, 06:02 AM
#5
Member
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 >
-
Mar 12th, 2021, 02:18 AM
#6
New Member
Re: Same navbar on multiple pages.
same issue here. I expect more.
-
Mar 12th, 2021, 09:39 AM
#7
Re: Same navbar on multiple pages.
Originally Posted by friendpicksd
same issue here. I expect more.
Nobody has responded to my original post, #3. How can I provide more without additional details?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|