Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Can I include a part of HTML code in many pages?

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

4 Answers

Relevance
  • 1 decade ago
    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:

    <body>

    <div id="wrapper">

    <div id="brand"></div>

    <div id="nav"></div>

    <div id="content"></div>

    <div id="boilerplate"></div>

    </div>

    </body>

    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.j...

    Have a look at the example. You're free to swipe any of the code and ask questions.

    Source(s): I'm the director of UIE at http://www.s8design.co.uk/
  • Anonymous
    5 years ago

    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!

  • Anonymous
    1 decade ago

    You need to use Server Side Includes (SSI): http://en.wikipedia.org/wiki/Server_Side_Includes

    Very easy to set up. I use them for lots of things that need to be updated and show on many pages after the update.

    Ron

  • 1 decade ago

    You can use frameset and frame for this but you have to manage this according to your requirment.

Still have questions? Get your answers by asking now.