-1

How to add navigation file as header of each page. For example I have a navigation.html file which contains the navigation for my Hybrid app. And I would like to add this (navigation.html) to all of my webpages (index.html, contact-us.html etc.) So all of my html pages have same navigation and easy to include. Not coding them in each page.

c.k
  • 1,075
  • 1
  • 18
  • 35
  • There is no way to dynamically include html files inside other html files unless you use a template system like Pug ( aka Jade ), you can also use PHP, but that's not what the language is for. – Baruch Jun 08 '16 at 02:50
  • @Baruch I have tried to use before something like twig. Do you know something like that which is best to use in developing my hybrid app? – c.k Jun 08 '16 at 02:57
  • When you say 'hybrid' what do you mean? Which languages are you using? – Baruch Jun 08 '16 at 03:00
  • @Baruch Hybrid Mobile App using HTML, CSS, and JavaScript. – c.k Jun 08 '16 at 03:08
  • 1
    I suggest you take a look at HandlebarsJS http://handlebarsjs.com/ – Baruch Jun 08 '16 at 03:17
  • Thank you, I will try this one. – c.k Jun 08 '16 at 03:27

2 Answers2

0

Based on your question, i think you can write it like this <?php include 'navigation.html' ?>

-1

This is not possible in just HTML and Javascript. You can learn some basic PHP and add it that way, but you would then need an apache web server with PHP enabled for your site to work. Another option is much more complicated, but you can learn a javascript framework like React or Angular which makes use of component hierarchy and rendering.

And. . . there is this magic command called CTRL-A CTRL-C CTRL-V

(Select all, copy, paste)

E.Arrowood
  • 750
  • 7
  • 17
  • `This is not possible in just HTML and Javascript.` Not true, you can use Handlebars, Jade, Twig, if you're using JavaScript you can use EJS, bunch of other systems that will allow you to do this. -1 – Baruch Jun 08 '16 at 03:01