I am now making a webpage and need a bit of help. Its been some time since Ive done my last page a few years ago. Back then I remember it was quite popular to use frames, but these days, this is basically no longer used. What I used to do is have a horizontal menu on the top as a frame, and underneath it the content frame. Now, currently I have a webpage again, where I would like to place a horizontal menu on the top of the page. The menu is written in pure CSS and HTML. The CSS is loaded from an external file, but the problem I now have is that the menu is basically a DIV element, which however I have to put into each page separately. I was just wondering there must be a way of making this simpler and have it somehow inserted from an external file again - sorry maybe it sounds confusing, but basically I am looking for an alternative of the frames used in the past. Many pages have menus and I am sure they do it somehow, because if I make a change in the menu, I dont want to be making these changes on all the hundreds of pages. I dont ask for any specific coding etc. I can google that myself if I dont know how to do it, but I just need a general recommendation how to solve this. Just to summarize, the menu is in HTML+CSS and the pages are mostly PHP, some of them HTML.
Asked
Active
Viewed 1,282 times
-1
-
This is typically done with a file that gets included on the server side using a language like PHP. – j08691 Aug 16 '13 at 14:25
-
You can create the menu in one file, and then just use php include anywhere you want the menu to appear `` for example – Brian Glaz Aug 16 '13 at 14:26
-
thanks, thats exactly what I kind of wanted, just what sort of "file" should it be? A simple TXT file with plain HTML? – Jachym Aug 16 '13 at 14:37
-
Solution available here: http://stackoverflow.com/questions/39447411/how-to-load-nav-menu-from-an-external-file-no-wamp-all-code-must-be-browser – Gabriel Sep 12 '16 at 17:08
2 Answers
0
I'd think it would mostly depend on the framework. You could just have one page, and use AJAX to load the content of each page, or you could have several php pages, all of which call some function at the beginning to set up the header, or you could use a ASP.NET master page or whatever your framework uses.

McKay
- 12,334
- 7
- 53
- 76
-
Thanks, well I dont have any experience with ASP or AJAX, but the PHP header option seems interesting, I will try to look it up. – Jachym Aug 16 '13 at 14:27
0
If you're using PHP, then the easiest way would be :
<?php include('my_page.html'); ?>
Be carefull of the path to your html page

Matt
- 343
- 2
- 7