1

I have a navigation bar that is in three of my website's files. I would like to put this bar (with css and all) in a separate file to import to these, as to make it so I wouldn't have to go through and edit all three navigation bars when I want to make a change. Is there a way to do this in Brackets?

agreis1
  • 790
  • 2
  • 11
  • 15
  • Are you open to using PHP for that? You don't have to code your whole site in PHP (except for one small php_inlcude line) but you just need to rename the file extension of your HTML files. – AndrewL64 Feb 06 '17 at 21:57
  • If you're doing pure HTML/CSS, there's no way of doing this. You will need to use a language like php or angular to do something like this. – ntgCleaner Feb 06 '17 at 21:58
  • @AndrewLyndem, He can only do this if he's running on a server that supports PHP. – ntgCleaner Feb 06 '17 at 21:58
  • @ntgCleaner Agreed. Most linux hosting servers online support PHP though hence why I recommended this solution. – AndrewL64 Feb 06 '17 at 22:00
  • 1
    @AndrewLyndem I agree, though since he's using brackets (and the complexity of his question), I assume he's writing local HTML. – ntgCleaner Feb 06 '17 at 22:00
  • @ntgCleaner Good point. – AndrewL64 Feb 06 '17 at 22:02
  • you can also do it with jquery, but not with just html: $(function () { $("#your-div").load("your-html-include.html"); }); – Wim Mertens Feb 06 '17 at 22:03

1 Answers1

0

If you are not 100% married to the files being .html, you could make your files .php and include your html by using <?php include "path/to.php"; ?>

oompahlumpa
  • 475
  • 2
  • 9
  • running PHP on the server is required. And contray to what most PHP developers think, there are a lot of servers (and localhosts) who do not run PHP – Martin Feb 06 '17 at 22:12
  • What @martin said is totally right. You will need to check with your host that you can run PHP on your server. – oompahlumpa Feb 06 '17 at 23:40