well, I'm about to make a website for a friend, he wants the pages to be in HTML so that he could edit them anytime he wants cause as you all know HTML is the easiest web code. The website will contain up to 50 HTML pages and a drop down menu in the header.
I know my friend will change the drop down menu contents from time to time, and for sure he'll never pass over all pages to change the menu code every time he add or remove a URL in the menu.
I know about <iframe> but it can't be done with <iframe> because it's a drop down menu and the menu contents must go over the page contents so <ifram> will not work.
I'm looking for a way to include the menu HTML code from an external file to all site pages in its place so that my friend can edit the menu once each time he change the drop down contents.
Thank you for reading my question. I would be grateful to read your suggestions
richarduie2010-11-16T20:17:22Z
Favorite Answer
I'm operating under the assumption that you DON'T have access to server-side programming, e.g., Java, PHP, etc. It could be done with JavaScript includes. Contrary to your belief, this COULD actually be done with frames, i- or otherwise, in conjunction with some nifty CSS. Since all of the frames would be from the same domain, they could easily communicate with one another. However, I quit using frames years ago, since they are often pesky in some ways and fell into disrepute in the corporate circles I used to inhabit.
A while back, I cobbled up an example of an Ajax based solution; that site may give you some ideas. The landing page is at:
http://home.comcast.net/~stratRich/stratRich.html
There are several pages, all of which have the same template body structure as follows:
The content div is the only element that holds content specific to the individual page. The brand, nav, and boilerplate containers are all loaded via Ajax calls - each of these three elements is constant across all pages. The Ajax GETs for the three static parts are managed by onload handlers. Each static part holds the HTML for that constant part of the pages.
All of the Ajax management is handled in the file http://home.comcast.net/~stratRich/js/stratRich.js and relies on the XhrWrapper object defined in the file http://home.comcast.net/~stratRich/js/XhrWrapper.js
Have a look at the example. You're free to swipe any of the code and ask questions.
When using SHTML, or PHP, or Coldfusion, or many other languages - you can use what is called an "include". Which does exactly what you want, include a single file on multiple pages so that you only have to edit code in one place. However, and im more than willing to be corrected on this, I don't think there is any way to use includes in bog-standard HTML. Edit: or use templates like pete says - silly me!